[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Math.Random() always returns 0
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 24 May 2006 09:10:12 -0300
BTW, there's always a simple replacement for rand() suggested by Knuth,
as quoted in Numerical Recipes:
do
local x=0
local a=1664525
local c=1013904223
function randomseed(s)
x=s
end
function rand()
x=a*x+c
return x
end
end
http://www.library.cornell.edu/nr/bookcpdf/c7-1.pdf
This is suitable for 32-bit integers.
--lhf