[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: The probability of returning zero by math.random is doubled.
- From: "Eero Pajarre" <epajarre@...>
- Date: Mon, 22 Sep 2008 17:53:46 +0300
On Mon, Sep 22, 2008 at 3:43 PM, Mike Pall <mikelu-0809@mike.de> wrote:
> Eero Pajarre wrote:
>> On Sat, Sep 20, 2008 at 4:31 PM, Mike Pall <mikelu-0809@mike.de> wrote:
>> > I was thinking about using them for the random number generator in
>> > LJ2. Since this needs to generate 52 bits for doubles (using the
>> > mask and subtract 1.0 trick) and since LJ2 needs 64 bit ints
>> > anyway, I've considered using one of these two:
>>
>> I hope you also keep the possibility to use the standard random number
>> generation. I appreciate the fact that programs running using JIT get
>> 100% similar results compared to non-JIT programs.
>
> Far from it! The 'standard' random number generator in Lua just
> calls rand() from libc. This means you'll get 100% different
> results for different platforms or different library versions.
> It's not thread-safe either. To add insult to injury, on some
> platforms you'll get 100% weak or non-uniform pseudo-random
> numbers, too! Are you really, really sure you want that? :-)
Yes!
I DO want that!
I mean, If I use "standard" rand() I want to get the same results as from
plain Lua. The only thing I want from JIT is lots and lots of performance :-)
Ok there might be other goodies related to LuaJIT but mostly I want plain
Lua compatible performance.
I know where to go, if I need good random numbers, and I don't expect it
to be math.random().
Ok more seriously, I would not complain if the standard Lua random number
generator would be improved.
Eero
- References:
- The probability of returning zero by math.random is doubled., Atry
- Re: The probability of returning zero by math.random is doubled., Mark Meijer
- Re: The probability of returning zero by math.random is doubled., Mark Meijer
- Re: The probability of returning zero by math.random is doubled., Mark Meijer
- Re: The probability of returning zero by math.random is doubled., Gé Weijers
- Re: The probability of returning zero by math.random is doubled., Dirk Feytons
- Re: The probability of returning zero by math.random is doubled., Dave Dodge
- Re: The probability of returning zero by math.random is doubled., Mike Pall
- Re: The probability of returning zero by math.random is doubled., Eero Pajarre
- Re: The probability of returning zero by math.random is doubled., Mike Pall