Comment by testaccount28
1 month ago
how can i pick a real number at random though?
i tried Math.random(), but that gave a rational number. i'm very lucky i guess?
1 month ago
how can i pick a real number at random though?
i tried Math.random(), but that gave a rational number. i'm very lucky i guess?
You can't actually pick real numbers at random. You especially can't do it on a computer, since all numbers representable in a finite number of digits or bits are rational.
Careful -- that statement is half true.
It's true that no matter what symbolic representation format you choose (binary or otherwise) it will never be able to encode all irrational numbers, because there are uncountably many of them.
But it's certainly false that computers can only represent rational numbers. Sure, there are certain conventional formats that can only represent rational numbers (e.g. IEEE-754 floating point) but it's easy to come up with other formats that can represent irrationals as well. For instance, the Unicode string "√5" is representable as 4 UTF-8 bytes and unambiguously denotes a particular irrational.
I was careful. :)
> representable in a finite number of digits or bits
Implying a digit-based representation.
4 replies →
Or use pieee-754 which is the same as iee-754 but everything is mimtipled by pi.
2 replies →
Pick a digit, repeat, don't stop.
Exactly right. You can pick and use real numbers, as long as they are only queried to finite precision. There are lots of super cool algorithms for doing this!
That's just saying that you can pick and use rational numbers (which are a subset of the reals.)
3 replies →
At no point will your number be transcendental (or even irrational).
That's why you can't stop.
4 replies →
And don’t die.
How did you test the output of Math.random() for transcendence?
When you apply the same test to the output of Math.PI, does it pass?
All floating point numbers are rational.
All numbers that actually exist in our finite visible universe are rational.
3 replies →
Well, except for inf, -inf, and nan.
1 reply →
Use an analog computer. Sample a voltage. Congrats.
Sample it with what? An infinite precision ADC?
This is how old temperature-noise based TRNGs can be attacked (modern ones use a different technique, usually a ring-oscillater with whitening... although i have heard noise-based is coming back but i've been out of the loop for a while)
Well, sampling is technically an analog operation that is separate from the conversion operation that makes the result digital. But then analog circuits don't ever actually hold a single real number, in practice there is always noise and that in practice limits the precision to less than what can be fairly easily achieved digitally.
1 reply →
Use an analog computer how, to do what? An analog computer can do analog operations on analog signals, but you can't get an irrational number out of it ... this can be viewed as a sort of monad.