Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Random numbers

  1. Apr 21, 2010 #1
    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?
  2. jcsd
  3. Apr 22, 2010 #2

    Filip Larsen

    User Avatar
    Gold Member

    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).
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook