Skip to content
Back to formatted view

Raw Message

Message-ID: <CAG8FheOLABuPEFMBWZ5GakFUGrBgibdTJc2bDLi=5qXAsus6Uw@mail.gmail.com>
Date: 2015-04-13T09:12:59Z
From: Isabel Natario
Subject: Finding which seed resulted in a specific sample

Hello!

I was wanting to find out which random seed could generate the characters
in the word "love", for example, when I sample with replacement from the
vector of the letters. So I've written the code below:

seed=0
set.seed=0
x<-sample(letters,4,replace=T)
while (sum(x==c("l","o","v","e"))<4){
seed<-seed+1
set.seed=seed
x<-sample(letters,4,replace=T)
}

When I run this code I always get that the final x vector is
c("l","o","v","e"), but afterwards, when I try to set.seed iqual to the
value stored in object "seed" I can never reproduce this vector
c("l","o","v","e"), by doing sample(letters,4,replace=T). Why is that?

Thank you very much,

Isabel Natario
--
Dep. Matem?tica
Faculdade de Ci?ncias e Tecnologia
Universidade Nova de Lisboa
2829-516 Caparica, Portugal
icn at fct.unl.pt

	[[alternative HTML version deleted]]