RandomVariate

RandomVariate[dist]

gives a pseudorandom variate from the symbolic distribution dist.

RandomVariate[dist,n]

gives a list of n pseudorandom variates from the symbolic distribution dist.

RandomVariate[dist,{n1,n2,}]

gives an n1× n2× array of pseudorandom variates from the symbolic distribution dist.

Details and Options

  • RandomVariate can generate random variates for continuous, discrete, or mixed distributions specified as a symbolic distribution.
  • RandomVariate gives a different sequence of pseudorandom numbers whenever you run the Wolfram Language. You can start with a particular seed using SeedRandom.
  • With the setting WorkingPrecision->p, random numbers of precision p will be generated.

Examples

open allclose all

Basic Examples  (5)

Simulate a continuous probability distribution:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

Simulate a discrete probability distribution:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

Simulate a multivariate continuous distribution:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

Simulate a multivariate discrete distribution:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

Generate random numbers from a mixture distribution:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

Scope  (22)

Options  (1)

Applications  (30)

Properties & Relations  (17)

Possible Issues  (3)

See Also

SeedRandom  BlockRandom  RandomChoice  RandomInteger  RandomReal  RandomComplex  RandomFunction  RandomGraph  RandomImage

Introduced in 2010
(8.0)