mt_random() function
The mt_random() function returns a pseudorandom number in the range 0.0 - 1.0 by using the Mersenne Twister pseudorandom number generator. This is an open source library that quickly generates high-quality pseudorandom numbers with a period of 2 19937-1 and good distribution.
The pseudorandom numbers are excellent for simulations, such as Monte Carlo simulations. The pseudorandom numbers are also excellent for polling. For example, the numbers can provide a random sample of 1000 records from a table of 1,000,000 records.
This algorithm by itself is not suitable for cryptography because as few as 624 iterations are required to predict all future iterations. Wrapping this function with a hash function is likely sufficient to provide cryptographically secure random numbers.
Netezza Performance Server offers a built-in random() function that is based on the Linear Congruential Generator algorithm. The Mersenne Twister algorithm is often favored for certain randomness applications.
Syntax
mt_random = mt_random();
Returns
The function returns a pseudorandom number in the range 0.0 - 1.0.
Example
The following example pulls a distributed random sample of 10 records from the Customer_Table table:SELECT * FROM Customer_Table ORDER BY mt_random() LIMIT 10;