News for hackers. Stuff that matters.
Re:Random(Random(Random(Random()))) by awegio on Monday May 15, 2023 @05:46PM (#35954931)
In more formal terms, since it is a uniform distribution you can write

  random(x) = random()*x
then you can easily see that

  random(random(random())) = random()*random()*random()
The resulting distribution is not equal to random()^3, because e.g. the probability that all 3 random calls give you a number <0.5 is only 0.125.
Re:Random(Random(Random(Random()))) by jwsteigerwalt on Monday May 15, 2023 @09:55PM (#35956962)
Clear and simple explanation
Re:Random(Random(Random(Random()))) by hedora on Monday May 15, 2023 @09:58PM (#35956981)
Oh. Thanks for the explanation, but I thought random was taking a seed, which would have made this much cooler, like this:

https://www.jstatsoft.org/article/download/v007i03/892

Re:Random(Random(Random(Random()))) by ibrahimbeladi on Thursday May 18, 2023 @02:00AM (#35984539)
It depends on the language, some languages like JS does not take an argument. So, it is language-specific.
Re:Random(Random(Random(Random()))) by IIAOPSW on Monday May 15, 2023 @10:05PM (#35957027)
Took me a moment to understand that by random()^3 you meant the output of the random function to the power of 3, not some temporary function which we name "random^3" since that's also how we build it.