X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Frkiss.h;h=f3468db4e0f056edede0914c5a9d7cde72ea0bba;hp=b9b82cef4fc5b1ad4b434f61d7225747bc7aa9b8;hb=c014444f09ace05e908909d9c5c60127e998b538;hpb=41641e3b1eea0038ab6984766d2b3bca869be7fa diff --git a/src/rkiss.h b/src/rkiss.h index b9b82cef..f3468db4 100644 --- a/src/rkiss.h +++ b/src/rkiss.h @@ -68,6 +68,14 @@ public: } template T rand() { return T(rand64()); } + + /// Special generator used to fast init magic numbers. Here the + /// trick is to rotate the randoms of a given quantity 's' known + /// to be optimal to quickly find a good magic candidate. + template T magic_rand(int s) { + return rotate_L(rotate_L(rand(), (s >> 0) & 0x3F) & rand() + , (s >> 6) & 0x3F) & rand(); + } }; #endif // #ifndef RKISS_H_INCLUDED