[computer-go] C++ random numbers

Peter Drake drake at lclark.edu
Tue Aug 8 15:32:13 PDT 2006


How about this:

(uint64_t(rand()) << 32) | rand()

Is the casting necessary?

Peter Drake
Assistant Professor of Computer Science
Lewis & Clark College
http://www.lclark.edu/~drake/




On Aug 8, 2006, at 3:23 PM, Chris Fant wrote:

> Assuming you have a quality 32-bit generator, you can do something  
> like:
>
> uint64 r = (r32( )<<32) | r32( );
>
>
>
> On 8/8/06, Peter Drake <drake at lclark.edu> wrote:
>>
>> Okay, next question: how do I generate a random 64-bit unsigned  
>> integer?
>>
>> Thanks in advance for any help,
>>
>>
>> Peter Drake
>> Assistant Professor of Computer Science
>> Lewis & Clark College
>> http://www.lclark.edu/~drake/
>>
>>
>>
>>
>>
>> _______________________________________________
>> computer-go mailing list
>> computer-go at computer-go.org
>> http://www.computer-go.org/mailman/listinfo/computer-go/
>>
>>
> _______________________________________________
> computer-go mailing list
> computer-go at computer-go.org
> http://www.computer-go.org/mailman/listinfo/computer-go/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://computer-go.org/pipermail/computer-go/attachments/20060808/b22041f5/attachment.htm


More information about the computer-go mailing list