Answer by Salman A for Understanding "randomness"
Assuming that rand() returns a number between [0, 1) it is obvious that rand() * rand() will be biased toward 0. This is because multiplying x by a number between [0, 1) will result in a number smaller...
View ArticleAnswer by John S. for Understanding "randomness"
Actually, when you think about it rand() * rand() is less random than rand(). Here's why.Essentially, there are the same number of odd numbers as even numbers. And saying that 0.04325 is odd, and like...
View ArticleAnswer by Fabian Bigler for Understanding "randomness"
As others already pointed out, this question is hard to answer since everyone of us has his own picture of randomness in his head.That is why, I would highly recommend you to take some time and read...
View ArticleAnswer by HamoriZ for Understanding "randomness"
We can compare two arrays of numbers regarding the randomness by using Kolmogorov complexityIf the sequence of numbers can not be compressed, then it is the most random we can reach at this length... I...
View ArticleAnswer by sashang for Understanding "randomness"
It's easy to show that the sum of the two random numbers is not necessarily random. Imagine you have a 6 sided die and roll. Each number has a 1/6 chance of appearing. Now say you had 2 dice and summed...
View ArticleAnswer by Tom for Understanding "randomness"
There is no such thing as more random. It is either random or not. Random means "hard to predict". It does not mean non-deterministic. Both random() and random() * random() are equally random if...
View ArticleAnswer by johnny for Understanding "randomness"
Use a linear feedback shift register (LFSR) that implements a primitive polynomial.The result will be a sequence of 2^n pseudo-random numbers, ie none repeating in the sequence where n is the number of...
View ArticleAnswer by Loki for Understanding "randomness"
OK, so I will try to add some value to complement others answers by saying that you are creating and using a random number generator.Random number generators are devices (in a very general sense) that...
View ArticleAnswer by Alin Purcaru for Understanding "randomness"
Oversimplification to illustrate a point.Assume your random function only outputs 0 or 1. random() is one of (0,1), but random()*random() is one of (0,0,0,1)You can clearly see that the chances to get...
View ArticleAnswer by Daniel Earwicker for Understanding "randomness"
The accepted answer is quite lovely, but there's another way to answer your question. PachydermPuncher's answer already takes this alternative approach, and I'm just going to expand it out a little.The...
View ArticleAnswer by Donal Fellows for Understanding "randomness"
It's not exactly obvious, but rand() is typically more random than rand()*rand(). What's important is that this isn't actually very important for most uses.But firstly, they produce different...
View ArticleAnswer by Huub for Understanding "randomness"
Multiplying numbers would end up in a smaller solution range depending on your computer architecture.If the display of your computer shows 16 digits rand() would be say 0.1234567890123multiplied by a...
View ArticleAnswer by user479885 for Understanding "randomness"
Consider you have a simple coin flip problem where even is considered heads and odd is considered tails. The logical implementation is:rand() mod 2Over a large enough distribution, the number of even...
View ArticleAnswer by Jay for Understanding "randomness"
As others have said, the easy short answer is: No, it is not more random, but it does change the distribution.Suppose you were playing a dice game. You have some completely fair, random dice. Would the...
View ArticleAnswer by Janco for Understanding "randomness"
I guess both methods are as random although my gutfeel would say that rand() * rand() is less random because it would seed more zeroes. As soon as one rand() is 0, the total becomes 0
View ArticleAnswer by Juliet for Understanding "randomness"
It might help to think of this in more discrete numbers. Consider want to generate random numbers between 1 and 36, so you decide the easiest way is throwing two fair, 6-sided dice. You get this: 1 2 3...
View ArticleAnswer by PachydermPuncher for Understanding "randomness"
The concept you're looking for is "entropy," the "degree" of disorder of a stringof bits. The idea is easiest to understand in terms of the concept of "maximum entropy".An approximate definition of a...
View ArticleAnswer by user479538 for Understanding "randomness"
Most of these distributions happen because you have to limit or normalize the random number. We normalize it to be all positive, fit within a range, and even to fit within the constraints of the memory...
View ArticleAnswer by valadil for Understanding "randomness"
Here's a simple answer. Consider Monopoly. You roll two six sided dice (or 2d6 for those of you who prefer gaming notation) and take their sum. The most common result is 7 because there are 6 possible...
View Article