In message <[EMAIL PROTECTED]>, Paul Herma
n writes:
>>
>> >  EXAMPLES
>> >  The following produces a drop-in replacement for the traditional
>> >  random() and rand() functions using arc4random():
>> >      #define arc4random31()   (arc4random() & 0x7FFFFFFF)
>>
>> Not good.  Only true on 32 bit archs.
>
>Heh?
>
>random(3) produces numbers between 0 and RAND_MAX on my alpha.
>random(3) produces numbers between 0 and RAND_MAX on my i386.

Well, I'm right in principle but wrong in current practice, at
the very least make it:

#define arc4random31()   (arc4random() & RAND_MAX)

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
[EMAIL PROTECTED]         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to