There are lots of ways to select a random record or row from a database table. Here are some example SQL statements that don’t require additional application logic, but each database server requires different SQL syntax.

Select a random row with MySQL:

SELECT column FROM table
ORDER BY RAND()
LIMIT 1

 Devamını okuyun »

To generate random numbers with JavaScript we employ the random() method of the Math object. It returns a floating-point number between 0.0 and 1.0.
JavaScript Math object has several methods and we shall encounter three on this page – the first one being random().

var rand_no = Math.random();
alert(rand_no);

Devamını okuyun »

© 2011 Şimşek Mert Suffusion theme by Sayontan Sinha