X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Frkiss.h;fp=src%2Frkiss.h;h=f3468db4e0f056edede0914c5a9d7cde72ea0bba;hp=b9b82cef4fc5b1ad4b434f61d7225747bc7aa9b8;hb=e6523e56b8cc110aa38d698a993cb04b430e67b0;hpb=b534176d4acc15ca5d7fdf3f44d1afb4e33c899a 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