adder
Posts:
153
Registered:
10/3/07


Re: Random numbers
Posted:
Dec 22, 2007 4:08 PM


On Dec 22, 12:14 pm, vr <simple.pop...@gmail.com> wrote: > On Dec 23, 12:52 am, no comment <adler.m...@gmail.com> wrote: > > > > > On Dec 22, 10:43 am, vr <simple.pop...@gmail.com> wrote: > > > > On Dec 22, 11:35 pm, quasi <qu...@null.set> wrote: > > > > > On Sat, 22 Dec 2007 10:32:37 0800 (PST), vr <simple.pop...@gmail.com> > > > > wrote: > > > > > >On Dec 22, 11:16 pm, quasi <qu...@null.set> wrote: > > > > >> On Fri, 21 Dec 2007 10:57:00 0800 (PST), simple.pop...@gmail.com > > > > >> wrote: > > > > > >> >On Dec 21, 11:37 pm, bill <b92...@yahoo.com> wrote: > > > > >> >> On Dec 21, 3:16 am, John <iamach...@gmail.com> wrote: > > > > > >> >> > Given a function that returns a random number between 15, write one > > > > >> >> > that returns a random number between 17 for the case when it should > > > > >> >> > be integer and for the case it can be real. > > > > > >> >> Let S be the function that generates a RN between 1 and 5. Then > > > > > >> >> T = S_1 + S_2 + ... + S_7 > > > > > >> >> For the reals , RN_7 = T/7 > > > > > >> >May be this should fix it: > > > > > >> >For the reals , RN_7 = 1 + (T7)*3/14 > > > > > >> Yes, that fixes the range. > > > > > >> But it's still biased (that is, not a unform distribution). > > > > > >> quasi Hide quoted text  > > > > > >>  Show quoted text  > > > > > >Hmm. Let me simplify it: > > > > > >RN_7 = T*3/14  0.5 > > > > > >If you look at T*3/14, it just scales the sum of random numbers > > > > >uniformly using a constant multiplier. Did I miss to notice any non > > > > >uniformity here? > > > > > Yes, T is not uniformly distributed in its range. > > > > Ok. But if S_n is guaranted to be uniformly distributed in the range 1 > > > to 5, then doesn't it mean the sum of 7 such numbers will also get > > > distributed over 7 to 35? I'm just curious. Thanks. > > > The sum is not uniformly distributed over the integers from 7 to 35. > > Imagine for example tossing two fair dice. We are familiar with the > > fact that the sum is not uniformly distributed over the integers from > > 2 to 12: a sum of 2 is much less likely than a sum of 7. > > > In general, let n be a fixed positive integer, and let T_1, T_2, ..., > > T_n be independent reandom variables, each uniformly distributed oover > > the integers from 1 to 5. Let f be any function of n variables, and > > let X = f(T_1, T_2, ..., T_n). Then X cannot be uniformly distributed > > over the integers from 1 to 7. So any algorithm to produce a random > > variable uniformly distributed over the integers from 1 to 7 from > > independent random variables uniformly distributed over the integers > > from 1 to 5 must use a "variable" n. Some of the algorithms that have > > been proposed above do indeed use such a variable n, and work. > > Got it. Is this applicable only for finite possibilities such as an > integer interval? or is it valid for reals too? I think not, because > any specific real number has zero chance of getting hit, but we still > get some random real numbers (!). > > vr
The observation does not hold for "the reals." In fact, almost the opposite holds. Roughly speaking, let W be a continuously distributed random variable, and let f be a density function. Then there is a function g such that g(W) has density function f. So informally we can use a suitable function of W to simulate any continuous distribution.

