Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Pseudorandom number generator
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Non-uniform generators== {{Main article|Pseudo-random number sampling}} Numbers selected from a non-uniform probability distribution can be generated using a [[Uniform distribution (continuous)|uniform distribution]] PRNG and a function that relates the two distributions. First, one needs the [[cumulative distribution function]] <math>F(b)</math> of the target distribution <math>f(b)</math>: :<math>F(b)=\int_{-\infty}^b f(b') \, db'</math> Note that <math>0=F(-\infty)\leq F(b) \leq F(\infty)=1</math>. Using a random number ''c'' from a uniform distribution as the probability density to "pass by", we get :<math>F(b)=c</math> so that :<math>b=F^{-1}(c)</math> is a number randomly selected from distribution <math>f(b)</math>. This is based on the [[inverse transform sampling]]. For example, the inverse of cumulative [[Gaussian distribution]] <math>\operatorname{erf}^{-1}(x)</math> with an ideal uniform PRNG with range (0, 1) as input <math>x</math> would produce a sequence of (positive only) values with a Gaussian distribution; however * When using practical number representations, the infinite "tails" of the distribution have to be truncated to finite values. * Repetitive recalculation of <math>\operatorname{erf}^{-1}(x)</math> should be reduced by means such as [[ziggurat algorithm]] for faster generation. Similar considerations apply to generating other non-uniform distributions such as [[Rayleigh distribution|Rayleigh]] and [[Poisson distribution|Poisson]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)