X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwinboard.c;h=7bd3de0045d3b1cba321246e166c232398d62754;hb=8de20911a5b2cc7c7c92a0f6fdd158e169b1fad8;hp=cd2e98cf78d1cb0b0581eb7a304ed8944bcdfdd9;hpb=1787d72dbd0f3ff703050df00dc6ebb5eebe14d7;p=xboard.git diff --git a/winboard/winboard.c b/winboard/winboard.c index cd2e98c..7bd3de0 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -4072,6 +4072,26 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) * \*---------------------------------------------------------------------------*/ +/* + * Decent random number generator, at least not as bad as Windows + * standard rand, which returns a value in the range 0 to 0x7fff. + */ +unsigned int randstate; + +int +myrandom(void) +{ + randstate = randstate * 1664525 + 1013904223; + return (int) randstate & 0x7fffffff; +} + +void +mysrandom(unsigned int seed) +{ + randstate = seed; +} + + /* * returns TRUE if user selects a different color, FALSE otherwise */