chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] random returns the same number on x86_64 a


From: John Cowan
Subject: Re: [Chicken-hackers] [PATCH] random returns the same number on x86_64 all the time
Date: Sun, 4 Mar 2012 00:02:41 -0500
User-agent: Mutt/1.5.18 (2008-05-17)

Jim Ursetto scripsit:

> In this case the bottom 31 bits are always zero.

Can't that be changed to at least make it the top 31 bits?  As it is,
if you look at the bottom 3 bits, say, to get a random number from 0
to 7, it will always be 0.  Shifting will solve that, but if you shift
too much because your code is moving from 64-bit Chicken to 32-bit,
the value will always be 0 once again.

This is why Common Lisp doesn't provide an interface giving you "a random
integer", only a random integer in the range 0 to n for a given n.

-- 
Is not a patron, my Lord [Chesterfield],        John Cowan
one who looks with unconcern on a man           http://www.ccil.org/~cowan
struggling for life in the water, and when      address@hidden
he has reached ground encumbers him with help?
        --Samuel Johnson



reply via email to

[Prev in Thread] Current Thread [Next in Thread]