[R] Random real numbers

Carl Witthoft carl at witthoft.com
Wed Mar 3 00:00:01 CET 2010


Well, to be mathematically correct, you cannot choose random real 
numbers for the simple reason that we don't even have names for all the 
reals.
As all of you know (I hope :-) ), there are the same number (aleph-1) of 
reals in any length line segment you wish.  Aside from the unlikelihood 
that you could write a random number generator that produced, say, 
(3.14159^5.432- .3289^3.19847)^(0.274) ,  there are a whole pile of 
transcendentals that you'll never get.


So as always, settle for a random rational number amongst the 2^N values 
your floating point processor can actually produce.

Carl



More information about the R-help mailing list