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 1-5, write one > >> > that returns a random number between 1-7 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 + (T-7)*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?