# HG changeset patch # User sheepluva # Date 1302229828 -7200 # Node ID b0b57f247e02c1acf7fada497de648c0360d2b1f # Parent 9b0513507ba804e1c90c65fccdbeb22f99371a32 guess what. comments. yay for burning commits diff -r 9b0513507ba8 -r b0b57f247e02 hedgewars/uRandom.pas --- a/hedgewars/uRandom.pas Fri Apr 08 03:07:04 2011 +0200 +++ b/hedgewars/uRandom.pas Fri Apr 08 04:30:28 2011 +0200 @@ -19,6 +19,14 @@ {$INCLUDE "options.inc"} unit uRandom; +(* + * This unit supplies platform-independent functions for getting various + * pseudo-random values based on a shared seed. + * + * This is necessary for accomplishing pseudo-random behavior in the game + * without causing a desynchronisation of different clients when playing over + * a network. + *) interface uses uFloat; {$INCLUDE "config.inc"} @@ -26,10 +34,10 @@ procedure initModule; procedure freeModule; -procedure SetRandomSeed(Seed: shortstring); -function GetRandom: hwFloat; overload; -function GetRandom(m: LongWord): LongWord; overload; -function rndSign(num: hwFloat): hwFloat; +procedure SetRandomSeed(Seed: shortstring); // Sets the seed that should be used for generating pseudo-random values. +function GetRandom: hwFloat; overload; // Returns a pseudo-random hwFloat. +function GetRandom(m: LongWord): LongWord; overload; // Returns a positive pseudo-random integer smaller than m. +function rndSign(num: hwFloat): hwFloat; // Returns num with a random chance of having a inverted sign. implementation