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: http://www.ams.org/journals/mcom/1999-68-225/S0025-5718-99-00996-5/S0025-5718-99-00996-5.pdf BTW, I wonder why MINSTD is not listed in Table 3. chri -- http://profgra.org/lycee/ (site pro) http://delicious.com/profgraorg (liens, favoris) https://twitter.com/profgraorg http://microalg.info -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe