|   Mailinglisten-Archive | 
MK> hi.
Nabend Matthias,
MK> gibt es unter bei mysql eine funktion, die eine zufallszahl erzeugt?
kloar
--------------------------------------------------
RAND()
RAND(N) 
Returns a random floating-point value in the range 0 to 1.0.
If an integer argument N is specified, it is used as the seed value:
mysql> select RAND();
        -> 0.5925
mysql> select RAND(20);
        -> 0.1811
mysql> select RAND(20);
        -> 0.1811
mysql> select RAND();
        -> 0.2079
mysql> select RAND();
        -> 0.7888
You can't use a column with RAND() values in an ORDER BY clause,
because ORDER BY would evaluate the column multiple times.
In MySQL Version 3.23, you can, however,
do: SELECT * FROM table_name ORDER BY RAND()
This is useful to get a random sample of a set
SELECT * FROM table1,table2 WHERE a=b AND c<d ORDER BY RAND() LIMIT 1000.
Note that a RAND() in a WHERE clause will be
re-evaluated every time the WHERE is executed.
---------------------------------------------
=> http://www.mysql.com/doc/M/a/Mathematical_functions.html
mfg
kai
-- 
Kai Meder
www.cn-media.de
abraxxxas_(at)_fraggers.de
    php::bar PHP Wiki - Listenarchive