Returns a double precision, random number x, where 0 <= x <1, with an optional seed.
RAND ( [integer-expression] )
integer-expression The optional seed used to create a random number. This argument allows you to create repeatable random number sequences.
If RAND is called with a FROM clause and an argument in a query containing only tables in IQ stores, the function returns an arbitrary but repeatable value.
When no argument is called, RAND is a non-deterministic function. Successive calls to RAND might return different values. The query optimizer does not cache the results of the RAND function
The values returned by RAND vary depending on whether you use a FROM clause or not and whether the referenced table was created in SYSTEM or in an IQ store.
The following statement returns a 5% sampling of a table:
SELECT AVG(table1.number_of_cars), AVG(table1.number_of_tvs)FROM table1 WHERE RAND(ROWID(table1)) < .05 and table1.income < 50000;
The following statement returns a value of approximately 941392926249216914:
SELECT RAND( 4 ) FROM iq_dummy