New Version 6.0! |
---|

Try it for free with our fully functional 60-day trial version. |

Solutions

# Random Numbers

Whether you're using C#, Visual Basic (VB.NET), F#, IronPython, the *Extreme Optimization Numerical Libraries
for .NET* make it easy to make use of random numbers in your .NET applications.
The *Extreme Optimization Numerical Libraries for .NET* are a complete math,
vector/matrix and statistics package
for the Microsoft .NET framework. Features specifically related to random numbers include:

- Compatible with the .NET Framework's System.Random.
- Extended with many convenience functions.
- Four generators, with varying quality, period and speed to suit your application.
- Generate random samples from any distribution.
- More than 30 discrete, continuous and multivariate probability distributions.
- Generate sets of correlated random numbers from any set of distributions.
- Shufflers and randomized enumerators
- Fauré and Halton quasi-random sequences.

It is well known that the random number generator built into the .NET framework has some deficiencies.
With the random number generators in the *Extreme Optimization Numerical Libraries for .NET*,
you can generate high quality random numbers fast.

## Random Number Classes

The classes that implement random numbers live in the Extreme.Statistics.Random namespace.

### Random Number Generators

See the Random Numbers section of the Statistics Library User's Guide for detailed explanations.

- ExtendedRandom Extends the functionality of the built-in System.Random.
- MersenneTwister Represents a pseudo-random number generator based on the Mersenne Twister algorithm.
- GfsrGenerator Represents a generalized feedback shift register pseudo-random number generator.
- RanLux Represents a RanLux pseudo-random number generator.
- RanLux24 Represents a RanLux 24bit pseudo-random number generator.
- CorrelatedRandomNumberGenerator Represents a random number generator that produces correlated random variables.

### Probability Distributions

The random number generators can generate random numbers from any distribution. The distribution objects themselves also have methods to generate random variates. The following distributions are available:

- Continuous distributions: beta distribution, Cauchy distribution, chi-Square distribution, continuous uniform distribution, Erlang distribution, exponential distribution, F distribution, gamma distribution, generalized Pareto distribution, Gumbel distribution, inverse Gaussian distribution, Laplace distribution, logistic distribution, log-Normal distribution, normal distribution, Pareto distribution, piecewise distribution, Rayleigh distribution, student-t distribution, transformed Beta distribution, transformed Gamma distribution, triangular distribution, Weibull distribution
- Discrete distributions: Bernoulli distribution, binomial distribution, discrete uniform distribution, generic discrete distribution, geometric distribution, hypergeometric distribution, negative binomial distribution, Poisson distribution
- Multivariate distributions: Dirichlet distribution, multivariate normal distribution

For more on these distributions see the sections on Continuous, Discrete, and Multivariate distributions in the Statistics Library User's Guide for detailed explanations.

## Random Numbers QuickStart Samples

Our library comes with a large number of QuickStart samples that help you to get started in minutes. The following samples illustrate how to use the random numbers:

Project | Description | View source | ||
---|---|---|---|---|

RandomNumberGenerators | Illustrates the use of classes that implement pseudo-random number generators. | C# | VB.NET | |

NonUniformRandomNumbers | Illustrates ways of obtaining random numbers from a non-uniform distribution. | C# | VB.NET | |

QuasiRandom | Illustrates the use of quasi-random sequences in multi-dimensional numerical integration. | C# | VB.NET |

## Trial version

If you would like to evaluate the *Extreme Optimization Numerical Libraries for .NET*,
you can download a free, fully functional 60-day trial version.
In addition to the code samples discussed here, it includes about 70 other samples
as well as complete documentation for the entire library.

Copyright © 2003-2018, Extreme Optimization. All rights reserved.

*Extreme Optimization,* *Complexity made simple*, *M#*, and *M Sharp* are trademarks of ExoAnalytics Inc.

*Microsoft*, *Visual C#, Visual Basic, Visual Studio*, *Visual Studio.NET*, and the *Optimized for Visual Studio* logo

are registered trademarks of Microsoft Corporation.