RandomReal
✖
RandomReal
Details and Options

- RandomReal[{xmin,xmax}] chooses reals with a uniform probability distribution in the range xmin to xmax.
- RandomReal[spec,WorkingPrecision->n] yields reals with n-digit precision. Leading or trailing digits in the generated number can turn out to be 0.
- RandomReal gives a different sequence of pseudorandom reals 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.
Examples
open allclose allBasic Examples (6)Summary of the most common use cases
A random real number in the range 0 to 1:

https://wolfram.com/xid/0cg48hdsr-e9j

A random real number in the range to
:

https://wolfram.com/xid/0cg48hdsr-ym1

A random real number in the range 0 to 10:

https://wolfram.com/xid/0cg48hdsr-d8m

Five random reals in the range 0 to 1:

https://wolfram.com/xid/0cg48hdsr-yu4

A 3×2 array of random reals in the range to
:

https://wolfram.com/xid/0cg48hdsr-tlb

Random coordinates for 4 points in 3 dimensions:

https://wolfram.com/xid/0cg48hdsr-eal

Scope (3)Survey of the scope of standard use cases
Generate random reals of any magnitude:

https://wolfram.com/xid/0cg48hdsr-hik

Generate random reals of any precision:

https://wolfram.com/xid/0cg48hdsr-qt4


https://wolfram.com/xid/0cg48hdsr-ihf


https://wolfram.com/xid/0cg48hdsr-w71

Options (1)Common values & functionality for each option
Applications (8)Sample problems that can be solved with this function

https://wolfram.com/xid/0cg48hdsr-qhp


https://wolfram.com/xid/0cg48hdsr-q7a


https://wolfram.com/xid/0cg48hdsr-vzl


https://wolfram.com/xid/0cg48hdsr-yny


https://wolfram.com/xid/0cg48hdsr-n6p

Three-dimensional random walk:

https://wolfram.com/xid/0cg48hdsr-y2i

Determinants of random 100×100 matrices:

https://wolfram.com/xid/0cg48hdsr-pqc

Generate a complex number in the unit square:

https://wolfram.com/xid/0cg48hdsr-emu


https://wolfram.com/xid/0cg48hdsr-ppj

Use RandomComplex instead:

https://wolfram.com/xid/0cg48hdsr-hpg25v

Generate exponential random variables using inversion method:

https://wolfram.com/xid/0cg48hdsr-epaqv6
Compare sample histogram with the PDF of ExponentialDistribution:

https://wolfram.com/xid/0cg48hdsr-bb5rni

Alternatively, use RandomVariate to sample from nonuniform distributions directly:

https://wolfram.com/xid/0cg48hdsr-ji6h06
Test whether both datasets could be samples from the same distribution:

https://wolfram.com/xid/0cg48hdsr-bv7zdk

Properties & Relations (5)Properties of the function, and connections to other functions
Use SeedRandom to get repeatable random values:

https://wolfram.com/xid/0cg48hdsr-dc7


https://wolfram.com/xid/0cg48hdsr-n9a

Use BlockRandom to block one use of RandomReal from affecting others:

https://wolfram.com/xid/0cg48hdsr-by6

With the same seed, RandomReal generates the "same" number, regardless of precision:

https://wolfram.com/xid/0cg48hdsr-cb6

RandomReal generates a uniform distribution, here with mean 0.5:

https://wolfram.com/xid/0cg48hdsr-l6m

RandomReal generates white noise:

https://wolfram.com/xid/0cg48hdsr-xaj

Wolfram Research (2007), RandomReal, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomReal.html.
Text
Wolfram Research (2007), RandomReal, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomReal.html.
Wolfram Research (2007), RandomReal, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomReal.html.
CMS
Wolfram Language. 2007. "RandomReal." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RandomReal.html.
Wolfram Language. 2007. "RandomReal." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RandomReal.html.
APA
Wolfram Language. (2007). RandomReal. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RandomReal.html
Wolfram Language. (2007). RandomReal. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RandomReal.html
BibTeX
@misc{reference.wolfram_2025_randomreal, author="Wolfram Research", title="{RandomReal}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/RandomReal.html}", note=[Accessed: 26-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_randomreal, organization={Wolfram Research}, title={RandomReal}, year={2007}, url={https://reference.wolfram.com/language/ref/RandomReal.html}, note=[Accessed: 26-March-2025
]}