[R] generate random numeric

Andrew Simmons @kw@|mmo @end|ng |rom gm@||@com
Fri Oct 29 08:50:56 CEST 2021


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 can find a lot more in the stats
package.


On Fri, Oct 29, 2021, 02:39 Ken Peng <ken using pubbox.net> wrote:

> 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 using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list