equal
deleted
inserted
replaced
33 |
33 |
34 procedure initModule; |
34 procedure initModule; |
35 procedure freeModule; |
35 procedure freeModule; |
36 |
36 |
37 procedure SetRandomSeed(Seed: shortstring); // Sets the seed that should be used for generating pseudo-random values. |
37 procedure SetRandomSeed(Seed: shortstring); // Sets the seed that should be used for generating pseudo-random values. |
38 function GetRandom: hwFloat; overload; // Returns a pseudo-random hwFloat. |
38 function GetRandomf: hwFloat; overload; // Returns a pseudo-random hwFloat. |
39 function GetRandom(m: LongWord): LongWord; overload; // Returns a positive pseudo-random integer smaller than m. |
39 function GetRandom(m: LongWord): LongWord; overload; // Returns a positive pseudo-random integer smaller than m. |
40 function rndSign(num: hwFloat): hwFloat; // Returns num with a random chance of having a inverted sign. |
40 function rndSign(num: hwFloat): hwFloat; // Returns num with a random chance of having a inverted sign. |
41 |
41 |
42 implementation |
42 implementation |
43 |
43 |
71 |
71 |
72 for i:= 0 to 1023 do |
72 for i:= 0 to 1023 do |
73 GetNext |
73 GetNext |
74 end; |
74 end; |
75 |
75 |
76 function GetRandom: hwFloat; |
76 function GetRandomf: hwFloat; |
77 begin |
77 begin |
78 GetNext; |
78 GetNext; |
79 GetRandom.isNegative:= false; |
79 GetRandomf.isNegative:= false; |
80 GetRandom.QWordValue:= GetNext |
80 GetRandomf.QWordValue:= GetNext |
81 end; |
81 end; |
82 |
82 |
83 function GetRandom(m: LongWord): LongWord; |
83 function GetRandom(m: LongWord): LongWord; |
84 begin |
84 begin |
85 GetNext; |
85 GetNext; |