# RandomReal vs Random[Real

Let's say I need random numbers with increasing precision to simulate a particular function, so I try:

Table[SeedRandom;
RandomReal[{0, 1}, WorkingPrecision -> i], {i, 1, 20}] // TableForm While I was experimenting with this, I checked docs for Random and tried the following variation.

Table[SeedRandom; Random[Real, {0, 1}, i], {i, 1, 20}] // TableForm Question(s)

1- For my own learning, I was wondering if someone could please explain the difference.

2- How was something like this done prior to v6.0?

3- Or am I comparing apples with oranges?

4- With the same SeedRandom, why are different random numbers being generated for the 2nd case as the precision changes?

• Probably a different algorithm is used for Random and RandomReal Jan 30, 2022 at 19:17
• The change with precision between 19 and 20 is a hint that it switched from a 64 bit unsigned integer method to a different algorithm. Log[10, 2.^64] is 19.2659. Jan 30, 2022 at 19:24

I reproduce this behavior with versions 5.2, 8.0.4, 12.3.1, and 13.0.0 on Windows 10 x64: As you see, before version 6 the behavior of Random was exactly the same.

I guess that peculiarities like this were the main reason why Random was superseded by the functions RandomReal and RandomInteger in version 6.0. Apparently, Random is kept only for backward compatibility purposes. All usage examples for Random were removed from the Documentation in version 6. Here is how its page looked in Mathematica Help Browser of version 5.2: I. Earlier one might have controlled precision with SetPrecision.

Either generate a random number with higher precision than needed and lower the precision:

Table[SeedRandom;
SetPrecision[Random[Real, {0, 1}, 100], i], {i, 1, 20}]


Or set the precision of a machine-precision number:

Table[SeedRandom;
SetPrecision[Random[Real, {0, 1}], i], {i, 1, 20}]


II. The legacy algorithm of Random[] is available for RandomReal[] and kin via the Method option in SeedRandom.

SeedRandom[1, Method -> "Legacy"];
RandomReal[]


generates the same sequence of random reals as

SeedRandom[1, Method -> "Legacy"];
Random[Real]


This reproduces the OP's Random[Real...] table:

SeedRandom[Method -> "Legacy"];
Table[SeedRandom;
RandomReal[{0, 1}, WorkingPrecision -> i], {i, 1, 20}] // TableForm