Author: Severi Salminen
Date: 13:15:49 11/04/02
Go up one level in this thread
>No, binary or does also not guarantee the order in which the different parts are >called. You are thinking of logical or. You are absolutely correct, thanks. I mixed those two. Maybe _I_ should read that "sequence point" topic more carefully :) >>unsigned __int64 rand64() >>{ >> return (ui) rand()|(ui)rand()<<15|(ui)rand()<<30 //and so on... >>} > > >It is even worse. There is no guarantee, that rand() returns exactly 15 bits >(there is a guarantee, that it returns at least 15 bits). So, if an >implementation will return (say) 31 bits, you will have in average much more set >bits in the 64 bit number, than 0 bits. Not very random ... >When using xor, it at least gives something rather random looking back. True, again. Now we see results when one posts before activating that brain thingy...For some reason I thought that rand() returns 15 bits, exactly... >I also agree with all the other posters, who suggest to use your own PRNG or use >a program generated table. Yes, own rand() is the best solution. No need to guess what it is doing. And no need to include precompiled random number array.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.