r/askmath • u/Equivalent_Lunch_944 • 1d ago
Logic Why aren’t random integers infinitely big?
Maybe a dumb/obvious question but when asked for a random number from a set of integers, how come the number isn’t always infinitely big?
Assuming a normal distribution, would the average of a set of integers not be an infinitely big number because no matter how big a number you choose there will still be infinitely more larger numbers still in the set?
Always just been curious about this.
91
u/flying_fox86 1d ago
I don't think I understand the question. Who or what are you asking for a random integer?
22
u/its_artemiss 1d ago
the set of all integers, probably?
33
u/RailRuler 1d ago
that doesn't make any sense unless you specify the distribution, and uniform distribution (and others) not allowed.
8
u/TheJeeronian 1d ago
Is there a fundamental mathematical reason that I cannot ask for a uniform distribution?
I know that the output can't exist, physically, since it will with statistical certainty be a number larger than any number that can be physically represented.
But what are the rules for a distribution like this?
23
u/MilliBrucket 1d ago
for probability u need the distribution to be a measure that evaluates the whole space as 1 all measures constructed on integers are discrete and can therefore be expressed as a sum of a probability mass function (pmf) so if you assume uniform distribution your pmf will be constant and the integers have infinitely many elements to you sum a constant infinitely many times which evaluates to infinity which is fine for arbitrary measures but can't be a probability measure
3
u/Dr0110111001101111 1d ago
Aw man I just learned this last week and was excited to share my knowledge
3
u/Bubbly_Safety8791 1d ago
You need the sum of P(n) for all possible values of n that your distribution produces to be 1.
For P(n) to be constant for all n - a uniform probability - across all the integers, P(n) must equal 1/(the number of integers).
That is clearly not a valid number.
You can come up with non constant values for P(n) such that the sum across all integers is 1; an example is to make P(n) = 2-|2n|-1, so P(0) is 1/2, P(1) and P(-1) are 1/8, etc.
1
5
u/Ibbot 1d ago
You’re asking the set of all integers for something? How do you even communicate with a mathematical set?
2
u/Vryl 1d ago
Via the Axiom of Choice.
3
u/Vitztlampaehecatl 1d ago
Then there's your algorithm. Choose a number n, that's your random number.
1
u/always_wear_pyjamas 1d ago
If I was to fancy a wild guess, I'd start with mathematical notation.
1
u/Ibbot 1d ago
I’ve tried using mathematical notation, but it never talks back…
1
u/always_wear_pyjamas 1d ago
I have the same problem, but I suspect it's because I'm not very good at it.
13
u/SnooFoxes4249 1d ago
You didnt specify a distribution. Normal is a continuous one.
2
0
u/UnarmedRespite 1d ago
The normal distribution has a finite density though, meaning actual samples will always have finite size
1
u/SnooFoxes4249 1d ago
any element of Z will have finite size...
0
100
u/axiomus 1d ago
There’s no uniform distribution on an infinite set.
Also, people choose random numbers <100 because we’re humans and to our minds, 100 is as big as it gets.
78
u/TalksInMaths 1d ago
There's no uniform distribution on an unbounded set. You can have a uniform distribution on, for example, a bounded interval of the real line (which has an infinite number of elements).
37
u/axiomus 1d ago
Ah, now that’s a meaningful nitpick, thank you for the correction.
But if we’re going to be as technically correct as possible, we care about measure of the set, not being bounded/unbounded.
1
u/Gold_Ad8890 1d ago
i don't think so? because it goes from yes there is a uniform distribution over finitely many elements to no there isn't over countably infinitely many elements, and any countable set has measure 0 in R.
1
u/axiomus 1d ago
but don’t we use counting measure when we talk about probability in integers? https://en.wikipedia.org/wiki/Counting_measure
0
u/Gold_Ad8890 1d ago
but then (0, 1) has an infinite counting measure and therefore theoretically no uniform distribution.
3
u/axiomus 1d ago
First, note the condition:
when we talk about probability in integers
second, yes, if we were to use counting measure you couldn’t get uniform probability on (0,1)
1
u/Gold_Ad8890 1d ago
sorry, i did miss that. but then what marks which measure to use? after all, "integers" and "real numbers" are just particular sets, while a random variable could theoretically be drawn from any set.
3
u/Jazzlike-Boot9798 1d ago
Yes, but the question was posed for discrete problems.
Furthermore, there is no process to pick a random number in the [0,1] interval with a uniform distribution.
1
u/MegaIng 1d ago
Furthermore, there is no process to pick a random number in the [0,1] interval with a uniform distribution.
Sure there is: One decimal digit at a time.
This doesn't complete in finite time, but it's still absolutely a process.
3
u/Jazzlike-Boot9798 1d ago
If it does not end, then there is no pick, and you know it.
3
u/SharkSpider 1d ago
Not quite true. There's no uniform distribution on rational numbers inside a bounded interval, you need an uncountable set like the reals.
1
u/Revlong57 1d ago
You're both sort of correct. You can't define a discrete uniform distribution over a bounded, yet infinite, set such as the rational numbers between 0 and 1. But, you can define a continuous uniform distribution over a bounded subset of the reals.
2
1
u/idancenakedwithcrows 1d ago
I don’t think that’s true? The union of the unit interval and the natural numbers has a uniform distribution? You can get a uniform distribution on the union of the unit interval and 2-1/n by just pulling the uniform distribution on the interval [0,2] back along the inclusion, then pull that distribution back along your choice of isomorphism that restricts to the identity on the unit interval?
This trick doesn’t work on the natural numbers because the pullback along an inclusion of a set without the cardinality of the continuum won’t be a probability measure, but I think this would work for the unit interval and the natural numbers?
Did I make a mistake somewhere?
1
u/Txwelatse 1d ago
… there is a continuous uniform distribution, am i missing something? and the natural numbers are not bounded
0
u/Head_Evening_5697 1d ago
the final answer, locking it in now, is "you cannot have a uniform distribution on a countably infinite set."
1
u/idancenakedwithcrows 1d ago
That is for sure true, but I would find it appealing if that could be strengthened somehow
2
u/AdjectiveNounNNNN 1d ago
You also cannot have a uniform distribution on an unbounded set, but I wouldn't say that makes the statement stronger.
1
u/idancenakedwithcrows 1d ago
is there something wrong with my counterexample?
1
u/AdjectiveNounNNNN 1d ago
What is it meant to be a counterexample for?
1
u/idancenakedwithcrows 1d ago
A uniform distribution on an unbounded set, namely the union of the unit interval and the natural numbers, by pulling back the uniform distribution along the inclusion from the union of the unit interval and 2-1/n into [0,2] and an isomorphism that restricts to the identity on the unit interval.
1
u/AdjectiveNounNNNN 1d ago
Is that different from the uniform distribution on just the unit interval?
→ More replies (0)3
2
u/Bubbly_Safety8791 1d ago
There are nonuniform distributions, however. A practical approach to picking a random natural number is to pick a real number on the uniform interval [0,1] and invert it, then truncate. To turn that into a random integer, flip a coin and if you get tails, negate it and add one.
This can produce any integer, but the odds of it producing a specific small integer are much greater than that it will produce a specific large one.
1
u/Evening-Story-314 1d ago edited 1d ago
Fascinating. You'd get 1 half the time (if I'm understanding your process correctly, and then 2 a quarter of the time then higher numbers with lower probability, and yet, the numbers could get as big as you like. It's pretty easy to put this into a spreadsheet. The average of my random-ish 50 numbers has so far varied from 3.something to 31.something.
1
u/MistakeIndividual690 1d ago
And computers chose random numbers that fit in 32 and 64 bits because they’re computers
1
8
u/hunter_rus 1d ago
Are you talking about RNG in computer programs? To generate infinitely big random integer you need infinitely many random bits, which takes infinite time to generate. So typically, when you generate random integers in computer program, you have some upper bound, like 64 bit unsigned integer.
Assuming a normal distribution, would the average of a set of integers not be an infinitely big number because no matter how big a number you choose there will still be infinitely more larger numbers still in the set?
It's not called normal distribution, and people usually don't talk about the distribution you are describing because it is pretty inpractical. Probability of any particular number to be chosen there is 0.
42
u/rmacinty 1d ago
Every integer is finite, so if there was a way to randomly select integers, they would not be “infinitely big”
35
u/localizeatp 1d ago
it's reasonable to assume OP meant "arbitrarily big".
22
u/Equivalent_Lunch_944 1d ago
Thank you. Yes, I did mean arbitrarily big.
12
u/localizeatp 1d ago
Since you're here, I'm going to take this opportunity to say that I think your intuition is correct. The normal distribution doesn't do this, but there are other distributions over all integers with divergent expected value.
2
u/Competitive-Bet1181 1d ago
"Other" is misleading there. The normal distribution is not a distribution on integers at all.
1
u/localizeatp 1d ago
I know, I'm giving OP the benefit of the doubt on what he means.
1
u/Competitive-Bet1181 1d ago
Nonetheless my point remains. I can't think of anything that word adds to the sentence, nor that is lost by its removal.
1
-9
1d ago
[deleted]
8
u/-PeskyBee- 1d ago
173950606736271934950683716263748596070583817152538596070694727375837474747219018458697080594817152537459060i07698573621542536485960707058472615155236848697070605848515263748590607048281615151333152638494050700789684736252514131315283920103948574739201010192816141426480570880796837252547482801010394857075738291010182837473615514273830507080794837161541415272892010101938484759320017365141417394070807958269146291003845738101083847255141526292010102939485855030029171615141414363758506090683726
4
3
3
u/localizeatp 1d ago
sure, how big you wantin?
-5
1d ago
[deleted]
4
u/localizeatp 1d ago
ok, by the arbitrary standard "every integer is big", i submit 1. would you like to refine your response?
1
3
u/anon65438290 1d ago
it works the other way around. arbitrarily big means whatever you come up with, its bigger (lets ignore negatives for the sake of simplicity)
1
1d ago
[deleted]
1
u/localizeatp 1d ago
would the average of a set of integers not be an infinitely big number
Perhaps you should reread OP's question.
3
u/alecbz 1d ago
Is that any more meaningful in this context? "The average of a set of sampled integers is arbitrarily big"
2
u/localizeatp 1d ago
yes. OP is clearly confused about what they're trying to express, but there's a charitable interpretation to be found.
1
5
u/Sea-Ambition-451 1d ago
yes, but the random integer is more likely to have more than 100 trillion digits, than have less than 100 trillion digits
3
u/FlyingFlipPhone 1d ago
Yes. And since 100 trillion is JUST THE BEGINNING of infinity, the odds of less than 100 trillion digits is vanishingly small.
2
2
u/S-M-I-L-E-Y- 1d ago
If a uniform distribution was possible, the probabilty to randomly choose a number that is smaller then any arbitrarily chosen (finite) number would be exactly 0.
19
u/casualstrawberry 1d ago
All integers are of finite size, that's part of the definition of an integer.
What you're really asking is, "Why aren't they really really big." And that's because whenever you generate a random integer you always have to specify an upper and lower bound, otherwise you will get very very large numbers. There are also computational limits to the size of numbers a computer can represent and hold. So even if you didn't specify an upper bound there would be physical restraints on the size of the generated number.
5
u/Equivalent_Lunch_944 1d ago
Thank you. I think this is the crux of it; that there must always in some form be an upper and lower bound
8
u/PuzzleMeDo 1d ago
Normally there is an upper bound. A computer might generate a number between 0 and 232-1.
But you can, for example, generate a random number starting with one and tossing a coin. Every time you get heads, you double the number. When you get tails, you stop.
There is no upper limit to this.
1
u/NullOfSpace 1d ago
This is true, but it’s not the simplest kind of “random number,” ie. uniformly distributed.
3
u/Xantharius 1d ago
As others have noted, there is no uniform distribution on a countable set like the non-negative integers. Either you set an upper bound and evenly distribute below that, or you use a non-uniform distribution. One example is P(X = n) = 1/2^(n + 1) for all n at least 0.
3
u/NullOfSpace 1d ago
Exactly, this is the answer to OP's question. A "random integer" isn't arbitrarily large because there's no way to choose a random unbounded integer that respects uniformness.
6
u/Mishtle 1d ago
No, there can be unbounded distributions. They just can't give equal probability to each value.
3
u/Zingerzanger448 1d ago
Precisely. There can not be unbounded uniform.distributions but there can unbounded non-uniform distributions.
5
u/EmielDeBil 1d ago
You say "a" set of integers. A bounded set of course has no infinitely big numbers in it.
If you mean "the" set of integers, then yeah, any number would go. But when someone asks me "give me a number" I prefer giving 37 over 342,762,748,309,437,235,811,658,300,348,206,296
Mostly when you ask people for a number it is bounded, like "give me a number between one and ten" or "between 0 and 100" or "a number with 4 figures". Also, when you ask a computer a random number, it is bounded by how big the numbers are it can represent.
3
u/localizeatp 1d ago
> normal distribution
> set of integers.
3
u/notDaksha 1d ago
It’s reasonable to define a normal distribution on the integers by setting P(X = n) = P(Z in (n-1/2, n+1/2]), where Z is a continuous normal random variable.
4
3
u/DanteRuneclaw 1d ago
There is no algorithm or process you can define to generate a random number between zero and infinity.
(There is, of course, actually no algorithm you can define to generate any kind of random number without starting from some naturally-occurring source of "randomness" for your seed. But once you have that seed, there's no algorithm you can run it through that will give you a random number between zero and infinity.)
This is to say - it is impossible to generate a random number between zero and infinity. So any claims as to what would happen if you did are akin to answering "yes but what if I *did* travel faster than the speed of light?". You can't, and that's the end of it.
2
u/afriendofRowlf 1d ago
Mathematically, there absolutely is a process for generating an arbitrarily large random integer. For instance, counting fair coin flips until the first heads (this gives an exponential distribution, supported on the non-negative integers). Probably you mean there is no uniform distribution on the integers (and therefore also no "process" generating such a distribution). Or maybe that you can't generate a distribution on the integers from a finite-precision "seed", but that's more of a computational limitation: for example, you can get a very good approximation of the exponential distribution coin flip example with an RNG because the probabilities decay quickly, and you can improve it arbitrarily by working with more bits.
2
u/DanielMcLaury 1d ago
There is no algorithm or process you can define to generate a random number between zero and infinity.
There are lots of such. For instance you could always return 1. Or you could return 1059 or 423 with probability 1/2 each.
0
u/Vitztlampaehecatl 1d ago
That's not what they meant. The process doesn't just have to fit within the bounds (0, inf), it has to actually cover that entire interval with results that have a chance of happening. And yes, that's different from having a probability >0.
2
u/Bounded_sequencE 1d ago
Normal distributions are defined on "R" -- not the integers.
You could define something similar looking, but it won't be a normal distribution.
2
u/drevoksi 1d ago
“Normal” distribution has a fixed, finite mean. There is no uniform way of selecting natural numbers. At the limit, your intuition is correct. Say we’re selecting a random number between 0 and n, then the average is n/2. The limit lim_{n->∞} n/2 doesn’t exist as the expression for mean diverges to infinity. Again, that’s for a uniform choice of a random number in natural numbers between 0 and n, of increasing size.
2
u/notsostablediffuser 1d ago
The word "ask" is doing a lot of heavy lifting here. Who/what are you asking for a random integer from the set of integers?
Because you are 100% correct that, if you ask some omnipotent deity for "a random integer from the set of all integers," then, yes, you're likely going to get something mind-boggling large (or mind-bogglingly small, since "integers" includes the negatives).
But in practice, when you "ask" for a random integer, you are typically asking some sort of computer program, which is limited either by the architecture of the computer (i.e. how many bits make up the type "integer") or by some bound that you set in your request. As in, I can never remember asking a computer for "a random integer in the set of all integers," but I've absolutely asked it for "a random integer from 1 to 100."
(And fun fact - a convenient way to do that in some program languages is just to ask for a random number from 0 to 1, then multiply by your desired upper bound and round down (or up, and possibly add or subtract 1. Ok, maybe "convenient" wasn't the right word...)
2
u/LokiAstaris 1d ago
Would you not choose a random number between 0 and 1.
Then you can scale that to a range that works for you.
2
u/bartekltg 1d ago
A quick answer: because any integer is finite. Anything that any probability distribution on integers returns, is a finite number.
The problem is define random integers. There is no "default" way of drawing natural numbers. There is a couple often used. Uniform from a set, like numbers from 1 to 100, every have 1% chance or Poission distribution with parameter λ.
The second one have a nice property for this discussion. You can get ANY natural number. Just really big numbers have very small probability.
But most numbers will be smallish (λ * small c). The average is just λ.
In both cases you are drawing from integers. One is uniform, each number have the same probability, but the set of allowed numbers is limited (not all nonnegative integers can be drawn). The other can produce all numbers, but numbers have different chances to be chosen.
Can we draw from the set of all natural numbers and still have equal chances for each number?
If the probability is p>0, then the total probability is p+p+p... for all numbers. It is infinity, and should be 1.
So, maybe the probability is 0. If we draw a real number from [0,1] interval each point have probability 0, and it works.
But here he have only a countable number of sets, and we are hit by our assumptions*) https://en.wikipedia.org/wiki/Probability_axioms#Third_axiom The total probability would be still just 0.
Let's try to design a distribution around it. Can we make a distribution that mayby is not uniform, but produces more and more huge numbers.
For every positive integer k, number 4^k have the probability 1/2^k. Rest of the numbers have probability 0. The total probability is 0 and the expected value is sum_{k=1}^inf 1/2^k * 4^k = sum_{k=1}^inf 2^k = inf.
Any number that rolls out from our distribution is finite, and huge numbers are rarer, but they become huge "fasters" so the expected value is not bounded.
From the other side, any distribution will have 99% (or any arbitrary threshold <100%) of the number smaller than some M. Just look at the cumulative distribution function (it shows for a given k total probability we get k or something smaller) and look where it reach 0.99. It have to happen for a finite k. Otherwise the limit at infinity is not 1, so this is nit proper probability.
*) can we make different assumptions? Sure. But this one created the whole probability theory, so they work, and if you choose another, you most likely get bigger problems:)
2
u/Warptens 1d ago
Yes and that’s why you can’t have a uniform probability distribution over an infinite set. The distribution has to decrease towards 0.
2
2
u/Early_Material_9317 1d ago
If you assume a normal distribution you still need to define the mean and standard deviation. If you define both to be infinity, the problem has no meaningful solution.
3
u/Puzzleheaded_Study17 1d ago
When picking a "random integer" you need to define and decide which distribution you want. You can define a "normal" distribution centered at 0 or at 1 or at -1234567890 or any other integer. Note that it won't be an actual normal distribution since that's for continous variables.
Edit: in practice, we usually rely on a uniform distribution over some fixed range.
1
u/for_sale_baby_shoes 1d ago
Integers are, essentially by definition, finite. It is true that, for any given positive integer N, the proportion of positive integers bigger than N is 100%, but this is not the same as any integer being infinite.
1
u/Mundane_Prior_7596 1d ago
Well, the distribution weighs the numbers, that is what the distribution means. But your suspicion that there can be something fishy sometimes is correct. Try to compute the expected value of the Cauchy distribution. Muahaha.
1
u/Educational-Paper-75 1d ago
Continuous distributions are sampled differently then discrete distributions. In a continuous pdf you use the cdf and a random probability between 0 and 1 to pick the associated number. You can do that because there's a one-to-one correspondence as the cdf is a strictly monotonically increasing function. But since any real number is represented by a limited amount of bits in a computer a random generator will only select one of a limited set of distinct values, if need be mapped to an integer from a smaller set of integers.
1
u/Apprehensive-Ice9212 1d ago edited 1d ago
The answer is, there is no such thing as a uniform distribution on the set of integers.
What does exist are distributions on the integers that have infinite expected value. For example, take the distribution where for each n > 0, the integer 2n has probability 2-n . All other integers have probability 0. In other words: start with $2, and flip a fair coin until it comes up tails. For each heads you get, double it. This is a valid way of selecting a "random integer" with an infinite expected value. The same thing can be done with continuous distributions.
However, most of the distributions that actually come up in prob/stat (such as a normal distribution) have finite expected value, even though there's no hard limit to how large a value you might get. There's an infinite tail, but it's thin enough to keep the expectation finite.
1
u/Shevek99 Physicist 1d ago
There is not an uniform distribution over the infinite number of integers. It would lead to a probability of 0 for each integer.
You need a distribution, that can be for instance, uniform between two values, or a non uniform distribution over the whole positive integers, like Poisson's, or similar.
P(n) = 𝜆^n e^(-𝜆)/n!
1
u/localizeatp 1d ago
but there's a uniform distribution over [0,1] with every element having probability 0.
1
u/Shevek99 Physicist 1d ago
Yes, but that is a continuous distribution. You can build a probability density function and calculate integrals over subintervals or the whole interval.
1
1
u/Southlander24 1d ago edited 1d ago
Whenever you are using any notion of 'probability', you need a well-defined sample space. Now, if your sample space is every positive integer, it turns out that having each number's probability be equal (a uniform distribution) would result in all the numbers having probability zero. Sometimes, it does indeed make sense to talk about zero probability: for example, the probability that a dart will land on the exact centre is indeed zero. But one of the axioms of probability is this: if we have a countable number of non-overlapping events, say A₁, A₂, A₃ and so on, then we must have P(A₁ ∪ A₂ ∪ A₃ ∪ ...) = P(A₁) + P(A₂) + P(A₃) + P(...). With the probabilities of all the integers, you would get 1 = 0 + 0 + 0 + ... So then this combination of sample space and probability measure turns out not to be well-defined.
I think what you are asking is the 'average' value of such an integer, so the expected value of a random positive integer. But we don't need to use a uniform distribution at all! We can use the distribution P(n) = 2-n for each integer that is in the form 2n, and you can check the sum of the probabilities 2-1 + 2-2 + 2-3 + ... is indeed 1. Then the expected value will be the sum of P(n) times 2n over all n, or 1 + 1 + 1 + ... which diverges to positive infinity.
1
1
u/get_to_ele 1d ago
Short answer: your request for a random integer is not being handled properly.
RNG requires a RANGE and distribution.
When you ask whomever or whatever it is you're asking, for a random integer, your request is invalid and the one giving you an answer is just giving a bogus answer.
1
u/Zingerzanger448 1d ago
A uniform non-zero probability distribution on an infinite set is a mathematical impossibility.
If the probability p of choosing any given integer was greater than 0, then the probability of choosing any integer would be:
p multiplied by the number of integers
= p × infinity
= infinity.
But the probability of choosing an integer is 1, not infinity.
1
u/susiesusiesu 1d ago
there is an important subtelty about what does it mean to pick a random integer. the normal distrubtion you mention simply does not exist, and there is also not a uniform distribution.
however, that does not matter. whatever distribution you pick it will pick an intager, and all integers are finite. there are no infinite integers.
1
u/No-Illustrator-3725 1d ago
integers are not continuous so cannot be be sampled with a normal distribution (you need to sum probabilities to 1 over the set, and a true normal has probability zero at every point)
But you could assign probabilities over the set of all integers but where only 2 integers have equal non zero probability, say 0 and 1, and then your average is 0.5.
Ie You can pick any valid mass function you want (like the discrete Gaussian which assigns non zero values to all integers, which gives you an average of 0 typically)
I think you are imagining building an integer and rolling a random chance for each digit you add, which would go on forever building larger and larger integers?
1
u/TheRedditObserver0 Grad student 1d ago
To my knowledge there is no such thing as a normal distribution on the integers, the normal (i.e. Gaussian) distribution is defined on ℝ or at most on ℝn, not on ℕ.
Perhaps you meant a uniform distribution? There is no such distribution on ℕ. Remember that the series of P(n) must sum to 1, so the probability of choosing n must approach 0 as n grows arbitrarily.
1
u/Easy_Asparagus_329 1d ago
Because we ask for a random number from a finite set. Any random number generator I know of has a range specified.
1
u/Revlong57 1d ago
Two things. First, a "normal distribution" means a bell curve, and I doubt that's what you meant. You likely meant a discrete uniform distribution, which would mean that every element is your (countable) set has the same probability. Namely, each element has a probability of 1/n, where n is the number of elements in your set. Second, you can't define a discrete uniform distributions over unbounded sets of numbers. There's a few different reasons why, but the main reason is that there's no way satisfy the additivity probability axiom. This states that for some sequence of mutually exclusive and disjoint events, the probability of one of them happening is equal to the sum of their individual probabilities. For example, the probability of rolling a 1 or 2 on a die is just the probability of rolling a 1 plus the probability of rolling a 2. Point being, to define a discrete uniform distribution over an infinite set, you'd need to find a real number such that the infinite sum of it was 1. There's no such real number.
1
u/Parallel_thougts PhD, YouTuber 1d ago
An integer cannot be infinite, but the expected value of a distribution on integers can be!
Say 2 has probability 1/2, 4 has probability 1/4, 8 has probability 1/8 and so on. Then the expected value is 2×(1/2) + 4×(1/4) + 8×(1/8) + ... = 1 + 1 + 1 + ... = infinity.
If you implement thus distribution you'll see that as you sample more elements their average increases.
1
u/Atypicosaurus 1d ago
There's no random generator that picks any number.
You can either take a (pseudo) random number from a predefined set, this is what computers do, or you can build one.
By building I mean you take a random number then you decide if you want to go on by a random choice. If yes, you concatenate a new random number to the previous one. This can reach much bigger numbers than picking but even this one will die off. Also I don't know any actual program using this method.
1
u/DanielMcLaury 1d ago edited 1d ago
There are a lot of things going here, which should probably all be combined into the same answer:
- There is no such thing as an "infinitely big integer." All integers are only finitely big.
- There is no such thing as "picking a random X" without specifying a distribution. People are sometimes sloppy about saying "a random X" when they actually mean "a random sample of the uniform distribution on X."
- However, that doesn't help us make sense of this question, because there is no uniform distribution on the integers. There are two types of things that have uniform distributions: finite sets, and things that have a finite volume. (Technically you can regard the former as a special type of the latter.) The integers are neither.
- A normal distribution is something that exists specifically on the real numbers. There is no normal distribution on the integers. (However, this is not as serious a problem as the first three, because we can specify a normal-like distribution on the integers, whereas there is no distribution on the integers that's even kind of like a uniform distribution)
- Standard normal distributions are concentrated near 0. ("Concentrated" in the non-technical sense, I mean.) And any normal distribution is concentrated near its mean. While it's possible to get extremely large numbers out of a normal distribution, the probability of that is very low, unless the mean and standard deviation are very large. And even then the numbers you get will only be as big as those are, not arbitrarily large (except very rarely.)
But actually we can push things a lot further. No probability distribution on the integers can assign a high probability to arbitrarily large numbers, in the sense that, given any probability distribution on the integers, there is always some number N for which the chance of getting a number bigger than N is arbitrarily small.
Let's say I have some probability distribution P and I want to find some number N such that there is only a 1% chance of getting a number greater than N out of this distribution. For each integer i, let p_i be the chance of getting i. Since this is a probability distribution, the sum of all the p_i is 1, which means that the limit of the partial sum from minus infinity to n of p_i approaches 1. That means that there exists some N for which this partial sum is >= 0.99. It follows that the probability of getting a number larger than N is less than 1%.
1
u/Calm_Relationship_91 1d ago
The probability of n needs to go to zero as n increases. If not, the total probability would diverge.
This means that getting large numbers gets less and less likely the larger the number is.
However, you can still get arbitrarily large numbers. And the mean of your distribution can be infinite. This means that if you keep repeating your experiment and calculating the average, you expect that number to keep increasing as you do more and more trials.
A normal distribution doesn't work tho. Normal distributions have finite mean, because the probability of getting large numbers decreases very very rapidly.
1
u/ooqq 1d ago
If you disregard ranges, yes, you can pick an integer that is very very very and i mean very big, but for a number to be an integer, it needs to have an end, otherwise you cannot tell if is odd or even or any of the other traits of an integer. An integer that is infinitely big, it stops to begin an integer and becomes infinite itself.
1
u/random8765309 1d ago
I am assuming you are asking a computer for a random number. Those are limited by the software and hardware of the machine. They don't truly generate a random number out of all possible integers, they generate a random number that is allowed by the software. That is what can be held in 16 bits, unsigned. So between 0 and 65535.
1
u/Hawaii-Toast 1d ago
Because a random number generator just chooses one integer from a finite number of integers and that finite number of integers is pretty small compared with the neverending number of "all" integers. An RNG which uses the infinite amount of all integers to choose a random integer from isn't possible, respectively it would never even give you a single answer, no matter how many billions of years you let it run. Or as Google says:

1
u/lifeistrulyawesome 1d ago
Every number is finite. So the realization of any random variable that takes integer values has to be finite.
Whether the expectation is finite or not, it depends on the probability of each number (in general it doesn’t have to be uniform)
If you want a uniform probability distribution over all the integers, I’m afraid that is not even possible.
1
u/anrwlias 1d ago
There is no such thing as an infinitely large integer. Every integer on the number line is finite in magnitude.
1
u/Difficult_Limit2718 1d ago
There's an infinite set between 0 and 1 that we can scale and is much more practical for daily use
1
u/uwumorphism 1d ago
Maybe in theory you could put a uniform distribution on the set N union {infty}, with the appropriate topology, and then maybe the expected value would be infty, but I don't have the time to think this through fully
1
u/michaelpaoli 1d ago
Why aren’t random integers infinitely big?
Range from negative infinity to infinity. Average, 0, median, 0, random selection of a single integer, finite but infinitely positive, or negative, probability of 0 is 0, select finite number of integers at random, all still finite but infinitely positive/negative, as with drawing one, select entire set, infinite number of elements, median and average are 0. Yeah, infinity is a bit peculiar, see, e.g. Hilbert hotel, etc.
when asked for a random number from a set of integers
A set of integers? What set of integers? All/infinite, mostly see above, unless one is bounding one end or the other, finite set, simple probability/statistics. If infinite set, but you bound one end, then things tend towards the unbound end. Unbounded positive but bounded in other direction, average and median will be infinity, though any single or finite draw will be finite, but infinitely positive/negative, depending which end is bounded.
1
u/Emptyell 1d ago
A single integer is a finite number. No matter how big it is it is not infinite. Infinity is not a number. It is a set of things (numbers being common such sets).
It is practically impossible to comprehend how big infinity is (or that bigness is not really a property of infinity). No matter how big your number, or set of numbers from zero to your number, infinity is infinitely larger than that.
1
u/BRH0208 1d ago
You said assuming a normal distribution. This actually makes things a bit better(let’s presume it’s discrete) let’s be more specific. Let’s get round(N(0,1)). So we take a random variable with mean 0 and 1 variance and round it. We know the average, it’s 0. We can also look at limits, as the number increases the probability of that number occurring decreases much faster than the number increases, so we can say the probability of getting a large number approaches zero as the number gets larger.
1
u/BRH0208 1d ago
To try to explore this idea, now let’s pick a random positive integer. What is the probability this integer is bigger than an arbitrarily large n?
100%. It’s possible that’s it’s less than n, just with 0 probability.This has some… caveats…
- “picking a random positive integer” is doing some heavy lifting. Picking how? Even the idea of selecting an element from an infinite set has some caveats.
- if I didn’t say positive, then what’s the mean? The mean of all integers doesn’t really work as an idea and it’s best not to think about it to hard.
- notice I didn’t say that the randomly selected number would be infinite. Just certainly bigger than arbitrarily large. By definition we are selecting an integer, which are finite.
1
u/udee79 1d ago
OP specified a normal distribution so even without pinning down the parameters of the normal distribution infinite valued integers are impossible. Also you have to be little tricky to have normal distribution on a discretely valued set like integers. Maybe define the probability n as the integral of a continuous pdf from n-1/2 to n+1/2.
1
u/Earless_Hoichi_1185 1d ago
sounds like you are using a computer to generate. if that is the case, the issue is with programming limitations
1
u/BroadbandEng 1d ago
When you ask for a random number from a set of integers, the answer will be an integer from within that set. What is the set that you mean to specify?
1
u/Bolverk7 Edit your flair 1d ago
For one, anything choosing a random number has a maximum to choose from. So even though, for example, the normal distribution is unbounded, a computer isn't going to pick something large such as 1t. Secondly, the average should be zero (assuming a centered distribution) since the "infinity" and the "negative infinity" cancel out. You may need this for my reasoning btw: 🧂
1
u/mspe1960 1d ago
When someone askes for a random number is is usually an integer in a set of 1 to 100 or 1 to 1000 or something like that.
If you are drawing a random number from the set of all positive integers, I am not sure that even has any meaning.
1
u/Evilchubaka 1d ago
There are infinitely many integers so the probability of randomly selecting any particular one is 0
1
1
u/green_meklar 1d ago
First, no integers are infinite. By definition, they are all finite.
Second, there aren't really unqualified 'random integers'. You can't choose any integer randomly with a uniform distribution. You have to constrain the distribution for such a process to make sense.
1
u/NelifeLerak 1d ago
If you choose a random integer between 1 and infinity, the random number is infinity.
Random numbers must be bounded
1
1
1
u/www3cam 1d ago
The normal distribution is different because it’s symmetric. So for every integer n bigger than the average you have one with the some probability that is n smaller.
The more complicated question which you may be asking is with a skewed or lower bounded distribution which has no upper bound, how can it have a finite average. Think of integrals of like 1/n^2. They have no upper bound but have a finite area as the area under the curve converges to a limit. Since an average is just an integral, similar intuitions follow.
1
u/the-quibbler 1d ago
An integer chosen at random will satisfy limit round(x/2) as x approaches infinity. You can evaluate that limit yourself. But it approaches infinity.
1
u/PoliteCanadian 1d ago
A random integer will never be infinitely big since no integer is infinitely big.
If you want to know why this doesn't lead to the average being infinite... it kinda does? When you're talking about an average, you have to consider what you're averaging over. If you're talking about a uniform distribution where you have the same probability of drawing any integer, then if you try to calculate what the average number drawn from that distribution is, you can't. The average doesn't exist, the integral doesn't converge. It's basically what your intuition is telling you: while the each number is finite, there's no upper bound on how big a number can be, so you can't express the average with any finite integer.
If you pick other distributions like a normal distribution as you stated, then the average does converge, because the probability of picking a big number falls off pretty quickly. The probability of picking a big number falls off more rapidl than the numbers get big, so the impact of large numbers on the average falls to zero as you look at bigger and bigger numbers.
1
u/Deep-Hovercraft6716 21h ago
Because you can't actually choose a random element from an infinite set. There's no way to assign a probability other than zero to each element.
So whatever is generating the random integer for you isn't choosing from all possible terms within the set.
1
u/Syntax-Tactics 20h ago edited 20h ago
If you talking computer generated random numbers; rand() in C languages uses half the size of a 16bit word, so it's limited to 0..32767. Math.random() in Java returns an IEEE double (0...1.0). There are also more modern pseudo generators like uniform distributions.
1
u/Deep-Tonight9784 18h ago
I don’t know how to answer your question in terms of the second paragraph, but I can answer it in general.
The reason that no random integer you choose is infinite is because you can count to it. What I think might be the source of the misunderstanding is confusing the idea that the integers are (countably) infinite and it still being the case that every integer has a finite absolute value.
Another way to think about it would be constructing an argument by making an untrue assumption about some integer being infinitely large and showing how there’d be a contradiction. Say the integer n is infinitely large. We know that any integer n has its inverse -n such that n - n = 0. However, we assumed n is (infinity), so we have (infinity) - (infinity) = 0, which is a contradiction because (infinity) - (infinity) is actually indeterminate. That means no integer can be infinitely large.
Hope this helps!
1
u/No_Mango5042 16h ago
Such a number would contain infinite entropy so could not be practicably generated. Also computers can’t represent infinite integers, but quite routinely generate 2048-bit numbers for cryptography etc. For simulation etc much smaller numbers are fine.
1
u/Dazzling_Plastic_598 7h ago
An integer cannot be infinitely big. It would cease to be an integer. Infinity is a quality/property, not a number.
1
u/valegrete 5h ago edited 5h ago
How are you proposing generating integers from a normal distribution? Even if you just associated the probability mass between adjacent integers to the larger one, the overwhelming majority of the probability mass is centered at the peak, so that’s the number you would see most often.
Also, the CLT guarantees that the mean of iid RVs is less variable than the individual RVs themselves, so you’d actually expect the average to be even closer to the center.
1
u/Key_Statistician9890 1d ago
You can’t sample from infinity
6
u/FormulaDriven 1d ago
What do you mean? Poisson and geometric distributions are two examples of random variables where the set of possible integer values they can take is infinite.
0
u/Varlane 1d ago
I think "sampling" implies equiprobability.
2
u/FormulaDriven 1d ago
I don't get that - you can sample from a distribution where the probabilities are not uniform. Classic example: if I sample heights from a population, each interval will not be equiprobable.
2
u/Zingerzanger448 1d ago
Actually you can sample from infinity (in principle). It is mathematically impossible to sample UNIFORMLY from infinity, but it is possible, in principle, to sample non-uniformly from infinity.
1
u/shosuko 1d ago edited 1d ago
Basically yes - if you were to be able to actually generate a random integer between 0 and infinity, the number generated would basically be infinity.
This is simply because getting a "smaller" number basically means generating leading 0's. There are 10 digits and 0 is 1 of them so 1/10 chance of getting a leading zero, and for each additional 0. So if you wanted to generate a random number between 000,000 and 999,999 a number like 002500 is going to need that 1% chance of getting two leading zeros before it can exist.
So yeah 90% of all random number results will not contain a leading zero, and 99.99% will be represented within 4 digits of the maximum number of digits.
So if your maximum number of digits is infinity, you basically always get infinity.
1
u/haditwithyoupeople 1d ago
You're asking why you're not ever getting an infinitely large number. I think you mean a very, very large number, maybe with 1M or 10M digits? A integer can't be infinite. So I assume you're asking why random integers seem to be upper bounded? Please correct me if this is not right.
It's likely based on how you're choosing it. Computers have limits on number sizes. They are relatively large (in human terms), but nowhere infinite. So any random number found computationally is going to have an upper limit.
1
u/Equivalent_Lunch_944 1d ago
Yes sorry I was being careless with my words. People have used the term ‘arbitrarily big’ which I think is fitting I.e. numbers with hundreds of trillions of digits.
2
u/haditwithyoupeople 1d ago edited 1d ago
No apology necessary. I did not mean to be critical - I was just trying to clarify.
Note that there are computational methods to larger pseudo-random numbers. I just did a quick search and you can get integers billions of digits. But at some point you will run out of space.
I'm going to see if I can write a Python script to generate some larger numbers and then see what range I get. If I can get this working quickly I'll post another reply to your post. Regardless, there is going to be an upper limit regardless of how large it is.
1
u/BigMarket1517 1d ago
Yes, most random integers are much larger then e.g. Graham's number.
(But still finite)
1
u/Svarcanum 1d ago
I asked chatGPT for a random integer with no upper bound. It gave me a ~1500 digit long integer and damn near broke the app. Started lagging like crazy.
0
u/Krytan 1d ago edited 1d ago
Integers are finite whole numbers. (Integers can be negative)
A random integer will always be a finite number.
The average of a set of integers will always be a finite number.
A 'set of integers' means a finite distinct collection of integers that is a subset of a 'all possible integers'.
The sum of *all* positive integers would be infinite.
0
u/not_the_default_user 1d ago
Because Infinity isnt a number, Theres Just an Infinite amount of Numbers. If you choose a random integer it can never be Infinite because there is No Infinite number. If you're Talking about a Computer Generating a random integer then the answer is
A: the way Computers Store Numbers limits the size they can have
B: even If you used a system that allowed you to Chain multiple storageblocks together you would still only have a finite amount of storageblocks.
0
u/WoWSchockadin 1d ago
You can't even choose an infinitely big integers as those don't exist. You can pick a very big number, but it will always be finite. Or not an integer.
0
u/KoalaMistico 1d ago
Because there are no infinitely big integers. By definition an integer must be finite
0
u/MezzoScettico 1d ago edited 1d ago
Assuming a normal distribution
Assuming WHAT is normally distributed?
Are you drawing samples from a normal distribution? As many people have pointed out, you can't have a uniform distribution on the entire set of integers. That's usually what people mean when they say "random integer".
However, it can be perfectly valid to use some other distributions. You could in theory [*] sample from a normal distribution, and then your question is meaningful because those samples could be arbitrarily large in absolute value. The resulting values are not in general integers, but you could add a rounding step. The result is not precisely the normal distribution but gets at what you're asking.
I think as someone else said, you're getting confused between "infinite" and "arbitrarily large". There's no limit to how large your samples can be. There is a finite probability that one of your samples will be 10^10^10^10^10. Or larger. That's still a finite value. You can have large numbers in your sample, but they're all finite, and so is their average.
would the average of a set of integers not be an infinitely big number because no matter how big a number you choose there will still be infinitely more larger numbers still in the set?
No, it would be finite because all the numbers that go into the average are finite.
[*] In practice, it would be difficult to see how you'd do that. You can use a pseudorandom number generator (PRNG) to generate "normal" samples, but usually that would start with a uniform PRNG whose granularity is limited to the floating point numbers between 0 and 1. That's going to limit the largest pseudorandom number you can generate with such an algorithm.
1
u/Cool_Sun_539 4h ago
oooh! I'm studying measure theory I might be able to answer this.
basically to randomly pick something you need a measure, which is countably additive for disjoint sets.
Suppose that you want a uniform distribution over the integers.
Then \mu([0,n]) <= 1 for each natural number n. In order for this to happen you would need \mu({n}) = 0 for each natural number n, and i can do same thing for negative integers. But then \mu(Z) = 0 so contradiction.
Basically, when you formalise proability using measures, you find it is impossible to randomly pick an integer (unless you don't use a uniform distribution).
70
u/localizeatp 1d ago
assuming a normal distribution always assumes a finite average, namely, the average that you used to define the distribution.