[R] geneation

Keith.Jewell at campdenbri.co.uk Keith.Jewell at campdenbri.co.uk
Thu Feb 20 13:37:38 CET 2014


On 20/02/2014 12:00, (Ted Harding) wrote:> [see at end]
>
> It seems clear that Izhak seeks to detach the random generation of y
> from the random generation of x after using set.seed(). On my reading of
>    ?RNG
> once set.seed has been used, as RUI says, it affects all subsequent
> calls to the generator. Initially, however:
>
>    Note:
>    Initially, there is no seed; a new one is created from the current
>    time when one is required.  Hence, different sessions started at
>    (sufficiently) different times will give different simulation
>    results, by default.
>
> But, even so, it still seems (perhaps) that using a RNG without the
> call to set.seed() will still establish a seed (and its consequences)
> for that session (in effect there is an implicit call to set.seed()).
>
> This leads me to suggest that a useful innovation could be to add a
> feature to set.seed() so that
>
>    set.seed(NULL)
>
> (which currently generates an error) would undo the effect of any
> previous (explicit or implicit) call to set.seed() so that, for instance,
>
>    set.seed(100)
>    x<-10*runif(10)
>
>    set.seed(NULL)
>    y <- rnorm(10)
>
> would result in y being generated from a seed which was set from the
> system clock. There is no form of argument to set.seed() which instructs
> it to take its value from the system clock (or other sourc of external
> random events); and indeed it seems that only the system clock is available.
>

<snip>

>
> For the time being (not having time just now) I leave the details
> to others ...
> Ted.
>
> -------------------------------------------------
> E-Mail: (Ted Harding) <Ted.Harding at wlandres.net>
> Date: 20-Feb-2014  Time: 12:00:07
> This message was sent by XFMail
>
Isn't your set.seed(NULL) the same as set.seed(as.integer(Sys.time())) ?

If so, I think Izhak can achieve his objective of reproducible random x and irreproducible random y with:
> set.seed(100)
> x<-10*runif(10)
> set.seed(as.integer(Sys.time()))
> y<-rnorm(10)


Keith Jewell - Statistician
Tel: +44 (0)1386 842055 (direct)
Email:  keith.jewell at campdenBRI.co.uk



________________________________

The information in this document and attachments is given after the exercise of all reasonable care and skill in its compilation, preparation and issue, but is provided without liability in its application or use. It may contain privileged information that is exempt from disclosure by law and may be confidential. If you are not the intended recipient you must not copy, distribute or take any action in reliance on it. If you have received this document in error please notify us and delete this message from your system immediately.

Companies (trading) within the Campden BRI Group:
Campden BRI (private company limited by guarantee, registered number 510618)
Campden BRI (Chipping Campden) Limited (private company limited by shares, registered number 3836922)
Campden BRI (Nutfield) (private company limited by guarantee, registered number 2690377)

All companies are registered in England and Wales with the registered office at Station Road, Chipping Campden, Gloucestershire, GL55 6LD.

The Campden BRI Group may monitor e-mail traffic data and also the content of e-mail for the purposes of security and staff training.

Unless otherwise expressly agreed in writing and signed by a duly authorised representative of Campden BRI, all goods, services and advice provided by Campden BRI shall be subject to our Standard Terms and Conditions of Contract a copy of which is available on request or can be downloaded from our website at http://www.campdenbri.co.uk/campdenbri/terms.pdf
CampdenBRIMMXIV

____________________________________________________________
This e-mail has been scanned for all viruses by MessageL...{{dropped:3}}




More information about the R-help mailing list