Re: 32-bit random numbers
Juergen Luethje wrote:
> return remainder(x, floor(n)) + 1
There might be a bug in here: you want a random number between 1 and n, so n
should also be a possible value.
If x is n, remainder(x, floor(n)) will return 0 instead of n: n can never be the
result of remainder(x, floor(n)).
I think you can solve this by changing it to: remainder(x + 1, floor(n)).
--
tommy online: http://users.pandora.be/tommycarlier
Euphoria Message Board: http://uboard.proboards32.com
|
Not Categorized, Please Help
|
|