I am normally not working with Mathematica, but I have to understand a code written in i!
Can some body say what the arguments and parameters of code below say?
RandomReal[NormalDistribution[mz, (mz - sz)/1.64485], nd]
Szabolcs encouraged me to post this as an answer. The use of RandomReal
and RandomInteger
with statistical distributions was introduced, I believe, in version 6, prior to the introduction of RandomVariate
in version 8. This can be seen by looking at the Mathematica legacy documentation, specifically version 6 tutorials:
The functions RandomReal, RandomInteger, and RandomComplex generate uniformly distributed random numbers. RandomReal and RandomInteger also generate numbers for built-in distributions.
RandomReal[dist] gives pseudorandom numbers from the specified distribution.
RandomReal[dist, dims] pseudorandom array with dimensionality dims, and elements from the specified distribution
RandomInteger[dist] pseudorandom number with specified distribution
RandomInteger[dist, dims] pseudorandom array with dimensionality dims, and elements from the specified distribution
Although this syntax is now deprecated in favor of the unifying RandomVariate
it nevertheless remains valid, confirmed through the current version 12.0.
To answer the question actually asked, consult the documentation for NormalDistribution
NormalDistribution[μ, σ]
represents a normal (Gaussian) distribution with mean μ and standard deviation σ.
So your code requests nd
samples of a normal distrubiton with a mean mz
and a SD of (mz - sz)/1.64485
.
RandomVariate
. In the future, look this up in the docs, e.g. by looking up the docs forNormalDistribution
, butRandomVariate[NormalDistribution[mz, (mz - sz)/1.64485], nd]
would mean you'd takend
samples from the normal distribution centered atmz
with std. dev.(mz - sz)/1.64485
. $\endgroup$RandomReal
. $\endgroup$RandomReal
was the original way to do this, and it still works in version 10.1 at least. $\endgroup$