Re: [R] generate random numeric

2021-10-29 Thread Ken Peng
That's all right. Thanks. On Sat, Oct 30, 2021 at 12:29 AM Marc Schwartz wrote: > Ken Peng wrote on 10/29/21 2:39 AM: > > I saw runif(1) can generate a random num, is this the true random? > > > >> runif(1) > > [1] 0.8945383 > > > > What's the other better method? > > > > Thank you. > > > Hi, >

Re: [R] generate random numeric

2021-10-29 Thread Marc Schwartz via R-help
Ken Peng wrote on 10/29/21 2:39 AM: I saw runif(1) can generate a random num, is this the true random? runif(1) [1] 0.8945383 What's the other better method? Thank you. Hi, You do not indicate your use case, and that can be important. The numbers generated by R's default RNGs are "pseudo

Re: [R] generate random numeric

2021-10-29 Thread Jeff Newmiller
It is difficult to do "truly random" number generation with computers, but fortunately number sequences that appear random but progress consistently from an initial seed value (?set.seed) are actually much more useful for analysis purposes than true randomness is. On October 28, 2021 11:39:07 P

Re: [R] generate random numeric

2021-10-28 Thread Andrew Simmons
It might not be random, depending upon a seed being used (usually by set.seed or RNGkind). However, it's the best method for generating a random number within a specified range without weights. If you want weights, there are many other random number generation functions, most notably rnorm. You c

[R] generate random numeric

2021-10-28 Thread Ken Peng
I saw runif(1) can generate a random num, is this the true random? > runif(1) [1] 0.8945383 What's the other better method? Thank you. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see h