On Mon, Apr 27, 2015 at 8:01 AM, Alexander Burger <a...@software-lab.de> wrote:
> […]
> A shift of 32 bits, however, would not suffice, because
> it would put the sign bit of the original 64-bit number into the MSB of
> the result.

OK, I understand.

I have some more ideas to try to make the behaviors of
(rand m n) in pil32 and ersatz the same, but maybe you are
not so much interested. Let me try one.
Would it be possible to just cast (Seed >>> 32) to a long:

if ((n = evInt(ex.Cdr) + 1 - ((Number)x).Cnt) != 0)
    n = (long)(Seed >>> 32) % n;
return new Number(((Number)x).Cnt + n);

Some naive tests (see here: http://pastebin.com/hnnRLPA0) seem
to confort my idea, but I may have missed something (again).

If still wrong, I may implement a smaller generator specially for my
language. Like one with just Xn+1 = a Xn, and
a(m−1)<2^53 (for ability to use withe JS numbers).
Inspired by Wikipedia and this paper:
BTW, I wonder why MINSTD is not listed in Table 3.



http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to