Returns a random value between 0 and 1, which is generated using the specified seed value, and computed for each returned row when used in the select list.
rand2([integer])
is any integer (tinyint, smallint, or int) column name, variable, constant expression, or a combination of these.
If there are n rows is table t, the following select statement returns n different random values, not just one.
select rand2() from t ------------
rand2, a mathematical function, returns a random float value between 0 and 1, using the optional integer as a seed value. Unlike rand, it is computed for each returned row when it is used in the select list.
The behavior of rand2 in places other than the select list is currently undefined.
For more information about the 32-bit pseudorandom integer generator, see the Usage section of rand.
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute rand.
For general information about mathematical functions, see “Mathematical functions”.
Datatypes Approximate numeric datatypes
Functions rand