Generating random numbers with known mean and variance

后端 未结 4 595
借酒劲吻你
借酒劲吻你 2021-01-19 17:19

From a paper I\'m reading right know:

...
S(t+1, k) = S(t, k) + ... + C*∆
...
∆ is a standard random variable with mean 0 and variance 1.
...
4条回答
  •  野性不改
    2021-01-19 17:57

    If all you want it a certain mean 0 and variance 1, probably the simplest is this. Do you have a uniform random number generator unif() that gives you numbers between 0 and 1? If you want the number to be very close to a normal distribution, can just add up 12 uniform(0,1) numbers and subtract 6. If you want it to be really exactly a normal distribution, you can use the Box-Muller transform, as Mark suggested, if you don't mind throwing in a log, a sine, and a cosine.

提交回复
热议问题