Hi,
As a slight aside, did you mean pseudo-random or quasi-random?
http://en.wikipedia.org/wiki/Pseudorandom_number_generator
http://en.wikipedia.org/wiki/Low-discrepancy_sequence
runif gives a sequence of pseudo-random numbers, for quasi-random numbers you
will need something else, for example the Sobol generator from
http://cran.r-project.org/web/packages/randtoolbox/index.html.
Martyn
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Frederico Mestre
Sent: 05 August 2014 11:28
To: r-help@r-project.org
Subject: [R] Generate quasi-random positive numbers
Hello all:
Is it possible to generate quasi-random positive numbers, given a standard
deviation and mean? I need all positive values to have the same probability of
selection (uniform distribution). Something like:
runif(10, min = 0, max = 100)
This way I'm generating random positive numbers from a uniform distribution.
However, using runif I can't previously select SD and mean (as in rnorm).
Alternatively, I'm able to generate a list of quasi-random numbers given a SD
and a mean.
b - (sqrt(SD^2*12)+(MEAN*2))/2
a - (MEAN*2) - b
x1 - runif(N,a,b)
However, negative values might be included, since a can assume a negative
value.
Any help?
Thanks,
Frederico
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
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.
This e-mail has been scanned for all viruses by Star.\ _...{{dropped:3}}
__
R-help@r-project.org mailing list
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.