lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Brian Hook wrote:
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.

I'll just take this opportunity to pimp a C random number
generator based on the FNV-1a hash.  Its main claim to fame
is being very very fast, though that's probably pretty irrelevant
compared to the overhead of calling it from Lua.  Its quality of
distribution of pseudorandomness is also pretty respectable
in casual use (though I don't know how it compares to MT etc).

http://icculus.org/~aspirin/fnvrand/

--Adam
--
Adam D. Moss   . ,,^^   adam@gimp.org   http://www.foxbox.org/   co:3