Hello,

I'm not sure I understand the question. When you use set.seed, it will have effect in all calls to the random number generator following it. So the value for y is also fixed. As for your code, you don't need the second set.seed. And though it is not syntatically incorrect, the way you are coding it is not very usual. Try instead

set.seed(100)
x <- 10*runif(10)
x

y <- rnorm(10)
y

y <- rnorm(10)  #different y
y


Hope this helps,

Rui Barradas

Em 20-02-2014 07:05, IZHAK shabsogh escreveu:
how do i use set.seed? for example i want to generate fix x with different 
value of y each time i.e

genarate x<-rnorm(10)
generate y<-rnorm(10)
i want have x fix but y changes at each iteration. this what i try but is not 
working


{
set.seed(100)

x<-10*runif(10)
}
x
set.seed(y<-rnorm(10))
y
        [[alternative HTML version deleted]]



______________________________________________
R-help@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.


______________________________________________
R-help@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.

Reply via email to