Random Functions

SQL Math provides a number of advanced pseudo-random number generators for use in t-sql and SQL Server.

Function Description
Rand_Mcg31m1 Multiplicative congruential generator using a modulus of 2^31-1 and a multiplier of 1132489760.
Rand_Mcg59 Multiplicative congruential generator using a modulus of 2^59 and a multiplier of 13^13.
Rand_MersenneTwister Random number generator using Mersenne Twister 19937 algorithm.
Rand_Mrg32k3a A 32-bit combined multiple recursive generator with 2 components of order 3. Based off of P. L'Ecuyer, "Combined Multiple Recursive Random Number Generators," Operations Research, 44, 5 (1996), 816--822.
Rand_Palf Represents a Parallel Additive Lagged Fibonacci pseudo-random number generator.  It uses the modulus 2 and by default the "lags" 418 and 1279.
Rand_SystemCryptoRandomNumberGenerator A random number generator based on the RandomNumberGenerator class in the.NET library. This is the random number generator used to generate random numbers in SQL Math distributions.
Rand_WH1982 Wichmann-Hill's 1982 combined multiplicative congruential generator. See: Wichmann, B. A. & Hill, I. D. (1982), "Algorithm AS 183: An efficient and portable pseudo-random number generator". Applied Statistics 31 (1982) 188-190
Rand_WH2006 Wichmann-Hill's 2006 combined multiplicative congruential generator. See: Wichmann, B. A. & Hill, I. D. (2006), "Generating good pseudo-random numbers". Computational Statistics & Data Analysis 51:3 (2006) 1614-1622
Rand_Xorshift Implements a multiply-with-carry Xorshift pseudo random number generator (RNG) specified in Marsaglia, George. (2003). Xorshift RNGs. http://www.jstatsoft.org/v08/i14/paper.  Xorshift random number generators form a class of pseudorandom number generators that was discovered by George Marsaglia.[1] They generate the next number in their sequence by repeatedly taking the exclusive or of a number with a bit shifted version of itself. This makes them extremely fast on modern computer architectures. They are a subclass of Linear feedback shift registers, but their simple implementation typically makes them faster and use less space. More Information.

Purchase SQL Math