[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Replacing rand()
- From: Brian Weed <bw@...>
- Date: Thu, 26 Feb 2004 12:38:10 -0500
Isn't there a way to override a library function like Math.random() ?
Wouldn't that be the best way for people to override the behavoir of
standard library function to suite there own needs?
For example, in Lua 4.0, I overrode the stand alone print(), and exit() for
my own needs so that any scripts (or even internal lua C functions) that
call them would get my version.
Maybe library methods are different? If they can't be individually
over-ridden, then maybe that should be looked into, since it seems like a
powerfull feature.
Brian
-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br]On Behalf Of Roberto
Ierusalimschy
Sent: Thursday, February 26, 2004 11:44 AM
To: Lua list
Subject: Re: Replacing rand()
> I noticed that Math.random() uses the C RTL's rand() function which as
> I'm sure everyone knows, is rather poor. It would be fairly trivial
> and small to put in an inline Mersenne Twister implementation.
>
> Have the Lua maintainers considered this?
Currently, the Lua distribution contains no third-party (copyrithed)
code and we would like to keep it that way. It will be great to have
this function implemented through a separate library.
-- Roberto