# Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

# RandomInteger

RandomInteger[{imin,imax}]
gives a pseudorandom integer in the range {imin,imax}.

RandomInteger[imax]
gives a pseudorandom integer in the range {0,,imax}.

pseudorandomly gives 0 or 1.

RandomInteger[range,n]
gives a list of n pseudorandom integers.

RandomInteger[range,{n1,n2,}]
gives an n1×n2× array of pseudorandom integers.

## DetailsDetails

• RandomInteger[{imin,imax}] chooses integers in the range {imin,imax} with equal probability.
• gives 0 or 1 with probability .
• RandomInteger gives a different sequence of pseudorandom integers whenever you run the Wolfram Language. You can start with a particular seed using SeedRandom.
• A Method option to SeedRandom can be given to specify the pseudorandom generator used.

## ExamplesExamplesopen allclose all

### Basic Examples  (5)Basic Examples  (5)

A random integer in the range 1 through 10:

 In[1]:=
 Out[1]=

A random integer in the range 0 through 3:

 In[1]:=
 Out[1]=

A random choice of 0 or 1:

 In[1]:=
 Out[1]=

20 random integers in the range 0 through 5:

 In[1]:=
 Out[1]=

A 3×4 random array of 0s and 1s:

 In[1]:=
 Out[1]=