[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: randomseed
- From: Philippe Lhoste <PhiLho@...>
- Date: Wed, 20 Nov 2002 11:53:54 +0000 (UTC)
On 2002/11/16 13:23:21, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-
rio.br> wrote:
>>Now, we don't have a time() function...
>
> Lua 5.0 has a time() function.
>
>>Perhaps try:
>>
>>dostring("timev = " .. date('%Y') .. date('%j') ..
>> date('%H') .. date('%M') .. date('%S'))
>>randomseed(timev)
>>
>>or other combinations of these values.
>>
>>There may be a simpler method...
>
> Yes, try:
> randomseed(date"%Y%m%d%H%M%S")
> --lhf
Oh, so all mathlib functions can take a string as a number input? And
probably all library functions needing a number, as they use internally
lua_tonumber.
I have missed this feature. Is it in the manual? Oh, yes, in "4.2 -
Coercion". Forgot it :-) The kind of seemingly innocent sentence that goes
unnoticed but is really signifiant...
--
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/