Ask Your Question

Is the 'rand' function in Calc truly random?

asked 2018-06-12 15:13:10 +0200

B37A gravatar image

Is the 'rand' function in Calc truly random?

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2018-06-13 00:32:53 +0200

Jim K gravatar image

updated 2018-06-13 00:44:40 +0200

As explained in the link from @erAck, Calc's numbers are pseudorandom.

Truly random numbers cannot be created by computation, because that is predictable. The only way to get truly random numbers is to extract from physical phenomena such as atmospheric noise, and that must be fed into the computer in some way.

edit flag offensive delete link more



The OP may be interested in comparing the randomness of the RNG functions from Calc, QuattroPro and Excel (recently in the news). I can not address that question, but perhaps someone else can.

ve3oat gravatar imageve3oat ( 2018-06-13 03:47:22 +0200 )edit

Is that If so, then that's just plain wrong, since although Excel does use a pseudo-random generator (the same as we do, afaik), it is the generated sequence distribution characteristic that matters (and it's fine), and it's wrong that "If you know one number at one step, you can compute all the numbers that will follow" - that "Prof. L’Ecuyer"'s citation is just a BS.

Mike Kaganski gravatar imageMike Kaganski ( 2018-06-13 07:44:35 +0200 )edit

The crucial part is "If you know one number at one step" so yes, if the PRNG is seeded with the same value in each initialization then the same sequence repeats in all runs. But LibreOffice uses std::random_device and time to seed. One can of course compute all sequences for all possible seed values and then take the last some generated numbers to lookup that partial sequence in those tables to predict subsequent numbers.

erAck gravatar imageerAck ( 2018-06-13 16:04:31 +0200 )edit

answered 2018-06-12 15:41:39 +0200

erAck gravatar image

It uses std::mt19937 that implements the Mersenne twister algorithm, see

edit flag offensive delete link more

answered 2018-06-13 09:25:21 +0200

nicola.di.bergantino gravatar image

If you are using a Unix variant system e.g. Linux, OSX, BSD etc. you have /dev/random wich is a respectable source of randomness.

See this page, it is quite informative, BSD style.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-06-12 15:13:10 +0200

Seen: 672 times

Last updated: Jun 13 '18