Random 5 function will ensure equal probability for all number starting from 0 to 5. Now consider an event that you will run that random 5 function twice. This will create 25 elements in your sample space. Now make seven groups of three elements. This means that each group will be having three elements now. There are other 4 elements remaining. While doing the experiment, it we encounter one of these four elements, we will perform the experiment again. These will ensure the 1/7 probability. Proof is as follows:
If we perform the random 5 function twice, we will end up with getting the followings: (0,0) (1,0) ....... ...... (4,0) (0,1) (1,1) ....... ...... (4,1) (0,2) (1,2) ....... ...... (4,2) (0,3) (1,3) ....... ...... (4,3) (0,4) (1,4) ....... ...... (4,4) So total there are 25 elements. Now make seven group of 3 elements .... {(0,0),(0,1),(0,2)} [mark it as 0], {(0,3),(0,4),(1,0)} [mark it as 1] ..... upto 7 seven groups We have {(4,1),(4,2),(4,3),(4,4)} elements remaining. If we encounter these elements during experiment, we shall ignore them and continue again. These will ensure 1/7 probability. For each number ( 0 to 7): probability : 3/25 + 4/25 * 3/25 + (4/25)^2 * 3/25 + ................ upto infinity = 3/25{1+ 4/25 + (4/25)^2 + ............. upto infinity} = 3/25 * [1 / (1- (4/25))] = 3/25 * 25/21 = 1/7 On 27 June 2010 16:57, sharad kumar <sharad20073...@gmail.com> wrote: > You have a random 5 function. Generate a random 7 function using this > random 5 function with equal probability > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- regards, soumya prasad ukil -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.