# RandomReal in combination with NormalDistribution [closed]

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]


## closed as off-topic by Henrik Schumacher, m_goldberg, Alex Trounev, Pinti, happy fishApr 19 at 10:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Henrik Schumacher, m_goldberg, Alex Trounev, Pinti, happy fish
If this question can be reworded to fit the rules in the help center, please edit the question.

• Not sure that should work...? It looks like it should be RandomVariate. In the future, look this up in the docs, e.g. by looking up the docs for NormalDistribution, but RandomVariate[NormalDistribution[mz, (mz - sz)/1.64485], nd] would mean you'd take nd samples from the normal distribution centered at mz with std. dev. (mz - sz)/1.64485. – b3m2a1 Apr 12 at 8:28
• Thanks @b3m2a1 Actually after 'nd' there is one more parameter as 'mz'. but it is editted and deleted:). but what you explained is very clear. Thanks! – Seda Apr 12 at 9:24
• Yeah I deleted that because it wasn't valid syntax and thus meant nothing without some enclosing context. If you would like it back you can re-edit it, but if you do you'll be missing something wrapping RandomReal. – b3m2a1 Apr 12 at 9:25
• Oh, ok! may be the code is incorrect I ll check it – Seda Apr 12 at 9:27
• @b3m2a1 RandomReal was the original way to do this, and it still works in version 10.1 at least. – Mr.Wizard Apr 12 at 9:55

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:

• Random Number Generation

The functions RandomReal, RandomInteger, and RandomComplex generate uniformly distributed random numbers. RandomReal and RandomInteger also generate numbers for built-in distributions.

• Continuous Distributions

RandomReal[dist] gives pseudorandom numbers from the specified distribution.

RandomReal[dist, dims] pseudorandom array with dimensionality dims, and elements from the specified distribution

• Discrete Distributions

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.

• Thanks a lot. it is a very useful info for me because the programmer wants to update the version for the program that he wrote. the parameters of distribution that I asked are also clear. Thanks!! – Seda Apr 21 at 13:05