[R] How to obtain seed after generating random number?

Paul Gilbert pgilbert at bank-banque-canada.ca
Fri Aug 27 20:14:48 CEST 2010


It is nearly impossible to go back after the fact and figure out the
seed you started with. So, you need to be careful to record the seed
first. If you are doing your simulations with a function then it is a
good idea to always start in the function by saving a record of the seed
and returning it with the result. Then you always have the information
you need.

Beware that the seed is not the only thing you need to save. You also
need to record the uniform generator you are using, and the generator
for the distribution you are using. Of course, if you always only use
the default then you won't have a problem here, until the default
changes.

You might want to look at the utilities and examples in the package
setRNG.

Paul

>-----Original Message-----
>From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org]
>On Behalf Of Bogaso Christofer
>Sent: August 24, 2010 1:12 PM
>To: r-help at r-project.org
>Subject: [R] How to obtain seed after generating random number?
>
>Dear all, I was doing an experiment to disprove some theory therefore
>performing lot of random simulation. Goal is to show the audience that
>although something has very rare chance to occur but it doesn't mean
>that
>event would be impossible.
>
>
>
>In this case after getting that rare event I need to show that same
>scenario
>for multiple times to explain other audience. Hence I need to somehow
>save
>that seed which generates that random numbers after doing the
>experiment.
>However as it is very rare event it is not very practical to start with
>a
>fixed seed and then generate random numbers. Hence I am looking for
some
>way
>which will tell me about that corresponding seed which was responsible
>to
>generate that particular series of random numbers responsible for
>occurrence
>of that rare event.
>
>
>
>In short, I need to know the seed ***after*** generating the random
>numbers.
>
>
>
>Is there any possibility to know this?
>
>
>
>Thanks and regards,
>
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-
>guide.html
>and provide commented, minimal, self-contained, reproducible code.
====================================================================================

La version française suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential information, and the Bank of
Canada does not waive any related rights. Any distribution, use, or copying of this
email or the information it contains by other than the intended recipient is
unauthorized. If you received this email in error please delete it immediately from
your system and notify the sender promptly by email that you have done so. 

------------------------------------------------------------------------------------

Le présent courriel peut contenir de l'information privilégiée ou confidentielle.
La Banque du Canada ne renonce pas aux droits qui s'y rapportent. Toute diffusion,
utilisation ou copie de ce courriel ou des renseignements qu'il contient par une
personne autre que le ou les destinataires désignés est interdite. Si vous recevez
ce courriel par erreur, veuillez le supprimer immédiatement et envoyer sans délai à
l'expéditeur un message électronique pour l'aviser que vous avez éliminé de votre
ordinateur toute copie du courriel reçu.


More information about the R-help mailing list