Re: Pb with the RAND() function simulating the throw of a 6 sideddices

Re: Pb with the RAND() function simulating the throw of a 6 sideddices

am 16.01.2003 14:34:16 von Alexander Keremidarski

Hello,

ZeBoss wrote:
> Hello to all of you,

Thank you for your bug report.

>
> I have met a possible bug with the RAND() function in MySQL.
>
> How-To-Repeat:


What you observed is fact that RAND() is not seeded well upon thread creation.
As a result FIRST call of RAND() after connect is almost "predictable".
If you run: SELECT RAND(); simultanously into several connection value will be
same rounded up to 2st digits after floating point.

We will investigate and fix it.




Meanwhile workaround is to use some digist from lower precision part of rand()
result value like:

SELECT REVERSE(RAND());
SELECT 10000*RAND() - TRUNCATE(10000*RAND(), 0);
SELECT MID(RAND(), 9, 1);

or any other "randomizing" technique.

--
MySQL Conference and Expo 2003 http://www.mysql.com/events/uc2003/index.html
For technical support contracts, visit https://order.mysql.com/?ref=msal
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Alexander Keremidarski
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer
/_/ /_/\_, /___/\___\_\___/ Sofia, Bulgaria
<___/ www.mysql.com




------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread13491@lists.mysql.com
To unsubscribe, e-mail