Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: sequence of random values is repeated as I re-run code

From   Nick Cox <>
To   "''" <>
Subject   st: RE: sequence of random values is repeated as I re-run code
Date   Fri, 4 Feb 2011 12:16:23 +0000

It really is difficult to comment on code not shown. But my guess is that somewhere in your code a statement of the form -set seed #- is ensuring this result. 

By the way, Stata's random number generator pays no attention as such to the date and time. The proof to the contrary is that if that were so, random numbers could never be reproduced. 

If you want to feed the generator a seed that is based on either the time or the date or both, you can do that, and that's your choice, but the algorithm is literally timeless. 


Prado De Castro Alfaiate, Jorge

I still could not understand why, but I found out that the same sequence of random values is created when I re-run my code.

Each time a random value is created Stata is supposed to get that random number by using a complicated function of time and date (with high precision), leading to a near-random number, right?

But then I do not understand how the same random numbers may come out again...

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index