News for hackers. Stuff that matters.
Re:What has a 1 in a million chance? by onion2k on Monday January 08, 2024 @03:43AM (#38909534)
That depends on the quality of your randomness. If it's a person picking the number that definitely isn't a 1 in a million chance for most numbers. You need to get pretty specialized hardware before you can confidently say it's definitely an equal chance for every number every time.
Re:What has a 1 in a million chance? by kortilla on Monday January 08, 2024 @03:46AM (#38909557)
No, you don’t need specialized hardware. The output of a modern hash for crypto absolutely needs to produce a uniform distribution across a million.
Re:What has a 1 in a million chance? by monsieurbanana on Monday January 08, 2024 @03:52AM (#38909594)
But how do you pick the input for the hash?
Re:What has a 1 in a million chance? by speedgoose on Monday January 08, 2024 @04:22AM (#38909775)
You need a seed, and a previous hash. The seed is usually sourced from another random generator, that uses environmental noise and some (salted) hashing as well.

In practice, a precise clock and a few difficult to guess events like keyboard and mouse inputs are enough to get a descent seed.

Re:What has a 1 in a million chance? by coldtea on Monday January 08, 2024 @03:58AM (#38909625)
Just bang away at the full keyboard for 50-100 characters?
Re:What has a 1 in a million chance? by danbruc on Monday January 08, 2024 @03:55AM (#38909606)
Current date and time.
Re:What has a 1 in a million chance? by p51ngh on Monday January 08, 2024 @03:57AM (#38909624)
Do you mean, after picking a million numbers, then every number in the range should have been picked exactly once?
Re:What has a 1 in a million chance? by jbstack on Monday January 08, 2024 @04:01AM (#38909645)
Definitely not this. That wouldn't be random at all. For example, after picking 999,999 numbers you would be able to predict the next number with certainty. What it means is that every time you select a number, every number in the range has an equal probability of being selected.
Re:What has a 1 in a million chance? by dtgriscom on Monday January 08, 2024 @04:35AM (#38909842)
Which means that there must be more state in the generator than is output as a random number; otherwise each time number X was produced then number Y would follow it. (Perhaps obvious, but I like stating the obvious.)
Re:What has a 1 in a million chance? by kortilla on Monday January 08, 2024 @03:46PM (#38917857)
No, each number has a 1 in a 1,000,000 chance each time the generator is used.
Re:What has a 1 in a million chance? by Tainnor on Monday January 08, 2024 @05:04AM (#38910051)
That's not a uniform distribution. Probability doesn't remember previous state, so the chance of picking the number 241 out of 1 million numbers remains exactly the same after picking 241 once. In particular, the chance of getting no duplicate numbers if you pick a million times, is very close to zero.
Re:What has a 1 in a million chance? by Tainnor on Monday January 08, 2024 @04:57AM (#38910007)
Technically, it's not actually uniform, or "random" - it only has to be indistinguishable from random, e.g. if you had access to a true random source and a pseudo-random one, it should be computationally infeasible to distinguish them.
Re:What has a 1 in a million chance? by nine_k on Monday January 08, 2024 @06:34AM (#38910620)
Given a finite amount of sample.values, you can always find a polynomial to match the values.

You can only proclaim that something is "truly random" on epistemological grounds, assuming that true randomness is somehow exposed by the universe. This holds under quantum physics, but not under classical mechanics. Unless there is some quantum effect, RNGs based on fluid dynamics, like lava lamps, may be completely deterministic, we just don't know how to set their initial conditions precisely enough.to reproduce a phase trajectory.

Re:What has a 1 in a million chance? by adrianN on Monday January 08, 2024 @07:05AM (#38910818)
Your polynomial has no predictive value in almost all cases.
Re:What has a 1 in a million chance? by nine_k on Monday January 08, 2024 @11:20AM (#38914233)
Yes. Finding out the nature of a PRNG and its initial state would allow one to predict next values, at least theoretically, that is, if it can be computed faster than the values are generated by the process we're looking at.

But the presence or absence of such a function for a naturally occurring process is, again, an epistemological question. That is, whether we can reverse-engineer the universe deeply enough. Unless we find its source code, we're stuck with retrofitting some formulas, and a "random process" is such for which we can't retrofit any better description than a statistical one.

Re:What has a 1 in a million chance? by Tainnor on Monday January 08, 2024 @12:52PM (#38915540)
You're right that we can never find conclusive empirical evidence for something being truly random, but we can say with confidence that a PRNG is not random because we can look at the algorithm.
Re:What has a 1 in a million chance? by misja111 on Monday January 08, 2024 @03:53AM (#38909600)
It still is a 1 in a million chance if you have no a priori knowledge about the way the random numbers are distributed.
Re:What has a 1 in a million chance? by HL33tibCe7 on Monday January 08, 2024 @04:06AM (#38909682)
I think true randomness was implied in GP’s comment. A person picking a number “randomly” from a million is not random in the mathematical sense.
Re:What has a 1 in a million chance? by mewpmewp2 on Monday January 08, 2024 @06:01AM (#38910417)
There's no evidence of true randomness though. There's only evidence of us having missing information to do the prediction of what any RNG would offer us next.
Re:What has a 1 in a million chance? by ackbar03 on Monday January 08, 2024 @04:03AM (#38909662)
Re:What has a 1 in a million chance? by coldtea on Monday January 08, 2024 @03:54AM (#38909601)
>If it's a person picking the number that definitely isn't a 1 in a million chance for most numbers.

Only if the person isn't aware of the issues involved.

Re:What has a 1 in a million chance? by whartung on Monday January 08, 2024 @01:50PM (#38916326)
It would be interesting what kind of clustering (if any) there would be if 1 million people were asked to pick a number between 1 and a million.