No repro:
> set.seed(123)
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.96
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 1.06
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.98
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 1.08
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 1.09
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.9
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 1.01
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 1.08
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 1.01
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.99
And:
> set.seed(123)
> replicate(10,sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T))
[1] 0.96 1.06 0.98 1.08 1.09 0.90 1.01 1.08 1.01 0.99
Exact same list of values (as expected) as replicate
is just a wrapper around sapply:
> replicate
function (n, expr, simplify = "array")
sapply(integer(n), eval.parent(substitute(function(...) expr)),
simplify = simplify)
With a small test I can find a seed replicating your problem (I think):
for(i in 1000:2000) {
set.seed(i)
if( all(replicate(10,sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)) < 1 )) {
print(i)
break
}
}
Gives me 1887 and so:
> set.seed(1887)
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.99
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.92
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.96
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.99
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.95
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.99
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.96
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.93
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.94
> sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T)[1]
[1] 0.99
> replicate(10,sample(seq(from = 0.9, to = 1.1, by = 0.01), size=1, replace=T))
[1] 1.07 1.06 0.97 1.07 1.00 0.99 0.91 1.01 1.05 0.97
set.seed()
at any point?