R语言中set.seed()函数的作用
set.seed()用于保证多次生成随机数的结果一致。
1、
par(mfrow = c(2,2)) a <- rnorm(10) plot(a, pch = 19, cex =2) b <- rnorm(10) plot(b, pch = 19, cex =2) set.seed(100) c <- rnorm(10) plot(c, pch = 19, cex = 2) set.seed(100) d <- rnorm(10) plot(d, pch = 19, cex = 2)