
Boost : 
Subject: Re: [boost] [random][rational] Is there any standard way to generate a random rationals?
From: MJanes (max.jns_at_[hidden])
Date: 20150310 06:29:52
Il giorno martedÃ¬ 10 marzo 2015 11:14:26 UTC+1, Thorsten Ottosen ha scritto:
> Given a random double in some interval, would it be possible to
> calculate the nearest rational number?
>
there's no nearest rational number, as there are inifinetly many of them in
any bounded neighbourhood of any real number. Unless by nearest you mean
the nearest rational with the greatest representable denominator... but in
this case the result will not be uniform anymore. As said, uniformity (
meaning prob(x in [a,b])=ba ) seems fundamentally impossible for rationals
for the aforementioned reasons ...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk