[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: randomseed [Re: Bug? in mathlib's random()]
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 23 Aug 1999 10:11:16 -0300
> The trouble is, when using Lua as a stand-alone, there's no good way to
> "randomly" seed the RNG -- date() returns a string,
If you call "date" with appropriate arguments, it returns a string in
numeric format, which is then converted to a number when used as argument
to randomseed. For instance, if you call
randomseed(date"%H%M%S")
your seed is a concatenation of the current hour-minutes-seconds (pretty
close to "real" time for random purposes).
-- Roberto