Are half of all numbers even? I've just written a quick algorithm that tests if a random number (decimal or whole) between -million and +million is divisible by 2. It iterated a million numbers. The sum of even numbers was ~50% every time.
I've read mixed opinions about if 'half of all numbers are even/odd'. My test shows it is true. But I feel I maybe missing something. Is there a mathematical explanation behind why this seems to be true?
 A: What you are testing is the distribution of numbers given by the particular pseudo-random number generator that your computer program is using. One of the most important properties of pseudo-random number generators is that each bit of the generated numbers appears to be random. This implies that the frequency of 0s and 1s should be equal (hence 50%), and hence the probability of odd or even numbers (being the last bit of the number) is the same.
From a mathematical point of view the things are not so easy as they appear. If your numbers have a range, for example $0$...$(2^{64}-1)$, then there is a unique uniform distribution of probability (one where each number has the same probability) and since there are an equal number of odd and even numbers in this interval, they have equal probability. If you instead pretend to consider a uniform distribution on the whole set of natural or whole numbers, this is not possible to have. Hence the concept of "probability of a number being even" is not uniquely understood. Possible probability measures usually are higher for small numbers and lower for high numbers. If, for example, $0$ is the number with higher probability, and the probability decreases with magnitude, than the even number would have slightly higher probability than odd numbers.
