Mathematica Generating Random Numbers in Mathematica 0-1 (2 Decimal Places)

Click For Summary
To generate random numbers between 0 and 1 with two decimal places in Mathematica, the Round function can be utilized effectively. For example, using Round[RandomReal[1, 10], 0.01] will yield the desired result. It's important to note that the WorkingPrecision option in the RandomReal function is intended for increasing precision rather than decreasing it. Caution is advised when using WorkingPrecision, as it may affect the distribution of the generated numbers, and this potential impact is not clearly documented.
jemma
Messages
35
Reaction score
0
I want to use the random number generator in mathematica to give me numbers in the range of 0 to 1, but only to two decimal places. Can anyone help?
Thanks.
 
Physics news on Phys.org
You can perhaps you Round, as in Round[RandomReal[1, 10], 0.01].

Note, that functions like RandomReal has an option called WorkingPrecision, which I guess should only be used when you want to increase the number of digits over the standard 6, and not when you want to decrease the number, unless you know for sure that this will not alter the distribution of the generated numbers (I am not able to see that in the documentation).
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K