Can you explain it more detailedly? A number composed of randomly generated log b bits is a number distributed between [0, b], is it equal to random(a, b) ?
On Tue, Apr 15, 2008 at 5:20 PM, Chonku <[EMAIL PROTECTED]> wrote: > What you need to generate is a random number between a & b using > random(0,1). I think a hint should be enough for you. Any given number n can > be represented using log n bits. > > > > On 4/14/08, Vishal <[EMAIL PROTECTED]> wrote: > > > If RANDOM(0,1) gives you only 0 or 1, then RANDOM(a,b) is expected to give > you a or b. > > > > > > > > On 4/14/08, deeepanshu shukla <[EMAIL PROTECTED]> wrote: > > > thanks for the reply , > > > but this will give only two nos. as Random(0,1) gives only o or 1 so > your algo gives either a or b .. > > > > > > but i hv got the right one........ > > > see first generate a generator using Random(0,1) which gives uniform > distribution between 0 and 1 .... > > > (generatinga bit string ad normalizing it) > > > > > > then multiplying by b-a........... > > > enjoy > > > > > > > > > > > > On 4/14/08, Karthik Singaram Lakshmanan <[EMAIL PROTECTED]> > wrote: > > > > > > > > RANDOM(0,1)*(b-a)+a > > > > > > > > > > > > On Mon, Apr 14, 2008 at 10:15 AM, deeepanshu shukla > > > > <[EMAIL PROTECTED]> wrote: > > > > > hello everybody ....... > > > > > can anyone help me solving this........ > > > > > > > > > > Describe an implementation of the procedure RANDOM(a, b) that only > makes > > > > > calls to > > > > > RANDOM(0, 1). What is the expected running time of your procedure, > as a > > > > > function of a and > > > > > b? > > > > > -- > > > > > Deepanshu Shukla > > > > > 3rd year , Mathematics and Computing, > > > > > I.T.-B.H.U. , > > > > > Varanasi,India > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- zhangfan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---