ZRandom: Random Numbers for Excel®

ZRandom implements a high quality pseudo-random number generator for Microsoft® Excel®:
  • Use the high quality Mersenne Twister algorithm to generate better pseudo-random numbers than the Excel® RAND() and VBA Rnd() functions.
  • Generate random numbers from 16 discrete and continuous distributions.
  • Functions for use in spreadsheet formulas.
  • A VBA interface to generate random numbers in your code.
  • Generate large amounts of random numbers interactive user interface.
A fully functional, 30 day trail version of ZRandom can be downloaded and tried out for free. If you decide to purchase ZRandom (and we hope you do), the cost is $29.95. Contact support@zrandom.com for more information.

     Download (621Kb)

High Quality RNG

The RAND() function in Excel® and the Rnd() function in VBA use very simple algorithms to generate pseudo-random numbers. In some Excel® versions, RAND() can even generate negative numbers! If a high degree of randomness or a large quantity of random numbers are required, these functions should not be used.

ZRandom uses the Mersenne Twister algorithm to generate pseudo-random numbers, one of the best algorithms available. Mersenne Twister is very fast and has a cycle period of 219937 - 1.

16 Distributions

ZRandom implements 16 discrete and continuous distributions. Pseudo random numbers can be generated from each distribution using the distribution wizard, directly in a spreadsheet cell using the Microsoft® Excel® functions and in VBA using the VBA functions.

Excel functions

The Mersenne Twister generator and all distributions can be used directly in spreadsheet cells or as part of more complex formulas. The ZRandom functions ZRAND and ZRANDBETWEEN accept an optional seed and can return both single cell values and arrays for even greater speed.
The ZSAMPLE function samples a random value from a list.



VBA functions

ZRandom can also be used from your VBA projects, just add a reference to "ZRandom" and use ZRandom.Next and ZRandom.NextBetween to generate random numbers, or use one of the functions to generate random variables from a probability distribution like NextPareto or NextHypergeometric.

Public Sub ShowRunningTotal()
' Re-seed ZRandom with the current time
ZRandom.Seed Timer
 
' generate 100 poisson numbers and keep a running total
Dim runningTotal As Double
Dim counter As Integer
For counter = 1 To 100
runningTotal = runningTotal + ZRandom.NextPoisson(5)
Next
 
' show the total
MsgBox "The total was: " & CStr(runningTotal)
End Sub


Interactive

All ZRandom number generators can be accessed from the ZRandom menu. ZRandom includes a distribution wizard, interactive random sort and random samples.




Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.