Talk:Random numbers: Difference between revisions
m
→Use _which_ formula?
No edit summary |
|||
(11 intermediate revisions by 8 users not shown) | |||
Line 1:
== Isn't this page misnamed? ==
Isn't this page misnamed? These are all pseudo-random numbers, I think.
: Nope. These are APIs into a provider for random numbers. What this provider is and how it works depends on the language, the implementation and the OS. Some may or may not produce pseudo-random numbers; some others may not.
== Formatting trouble ==
Here's SAS code, which I can't figure out how to format for this wiki right now:
data test;
do i = 1 to 1000;
x = rand("NORMAL",1,.5);
output;
end;
run;
sorry for editing without logging in - that was me all along...[[User:Sgeier|Sgeier]] 00:57, 7 April 2007 (EDT)
Line 21 ⟶ 39:
:: The base of the logarithm could indeed explain the standard deviation; using base 10 instead of base 2 would add a factor of sqrt(1/ln(10)), which indeed is just about 0.66. The second thing to check is the cosine: If MAXScript takes the argument of the cosine in degrees instead of radians, then in the formula the value 2*pi must be replaced by 360.
:: Additional note: Usually floating random number generators give numbers from the interval [0,1) (i.e. 0 included, 1 excluded). However this algorithm needs random numbers from (0,1] (0 excluded, 1 included). It doesn't really matter for b, but for a the value 0 would be fatal (the logarithm isn't defined at value 0). Thus you should check what the random number generator does, and in case it's indeed using the interval [0,1), use <tt>1.0 - random 0.0 1.0</tt> instead. --[[User:Ce|Ce]] 12:26, 21 September 2007 (MDT)
:::Thanks guys, it turned out to be cos expecting degrees rather than radians and I've fixed it now.
:::
== using a pi approximation ==
I noticed one programming example using 22/7 for the value of pi. Is this close enough for government work? Could/should it be flagged ''in need of improvement''? -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 18:45, 28 October 2014 (UTC)
== Are we allowed to use a built-in normally distributed RNG? ==
TI-BASIC has a command that generates normally distributed random numbers: randNorm(
Are we allowed to use it, or do we have to convert from uniformly distributed?
== Isn't this page redundant? ==
...with https://rosettacode.org/wiki/Statistics/Normal_distribution ? It's just a slightly simpler version of the same task, as far as I can tell. [[User:JoeStrout|JoeStrout]] ([[User talk:JoeStrout|talk]]) 18:58, 27 October 2019 (UTC)
== Use _which_ formula? ==
The task description says "use this formula" and links to a Wikipedia section that contains half a dozen formulas. Can we clarify which formula should be used? Or else change the link text to something like "use a formula such as one of these"? [[User:JoeStrout|JoeStrout]] ([[User talk:JoeStrout|talk]]) 18:58, 27 October 2019 (UTC)
:You are correct, it's misleading. However, the task asks simply to produce normally distributed random numbers, and there are many ways to do this. Any one should be acceptable, I think. I changed the task description accordingly. If you don't know which one to pick, the [https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform Box-Muller transform] is probably the simplest, though not the fastest. [[User:Eoraptor|Eoraptor]] ([[User talk:Eoraptor|talk]]) 20:20, 27 October 2019 (UTC)
|