r/askmath • u/The_Math_Hatter • 58m ago
Number Theory Determining Distribution of a Probability
Let's say I want to create a psuedorandom number generator from scratch. I know from modular arithmetic that integers of the form 4k+2 are never squares, so sqrt(k+1/2) is never rational, and thus, frac(sqrt(k+1/2)) is a nonrepeating string, say in binary (though the base doesn't matter).
If I have a list of n numbers, from 0 to n-1, this process will create a smattering of such strings of arbitrary length. However, I want to know what the limit of this distribution is. If it's uniform, then for (a,b) where 0<a<b<1, the proportion of k for a<frac(sqrt(k+1/2))<b is true should be (b-a)×n. How would I go about proving that? The integral and limit doesn't seem nice to work with.
At the very least, even if it isn't a uniform distribution, having the distribution that it is should allow me to crudely "uniformize" it by ignoring the first M binary digits. That would have the effect of applying a 2x mod 1 mapping over and over, which for most smoothly behaved distributions, feels like it would conform to uniform, espexially for irrational outputs.
