[R] How do you force runif to return non-duplicate results eg	runif(0, 1, n=10)? thanks
    Gabor Grothendieck 
    ggrothendieck at myway.com
       
    Tue May 18 14:14:26 CEST 2004
    
    
  
Briggs, Meredith M <Meredith.Briggs <at> team.telstra.com> writes:
How do you force runif to return non-duplicate results 
eg	runif(0, 1, n=10)? thanks
On my Windows XP machine I find that the first 100,000 random numbers
starting from seed 11 are unique even to machine precision. Is that enough?
R> set.seed(11); length(unique(runif(100000)))
[1] 100000
If you need 100 numbers that are unique to two decimal places, say, 
you can do this:
(sample(100, 100, rep=F)-1)/100
    
    
More information about the R-help
mailing list