Sanjeev
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
1. Draw 2 random numbers from rand5()
2. Add them. Possible outcome will be contained in set [2,3,4,...,10]
3. Map [2,3,4,...,8] --> [1,2,3,...,7] and reject [9,10]
Addition of two random variables will give a uniform distribution in the interval [2,3,..,8].
We are using this section to draw numbers from [1...7] uniformly.
I hope it's correct theoretically.
Comment hidden because of low score. Click to expand.
0
of 0 vote
1. Draw 2 random numbers from rand5()
2. Add them. Possible outcome will be contained in set [2,3,4,...,10]
3. Map [2,3,4,...,8] --> [1,2,3,...,7] and reject [9,10]
Addition of two random variables will give a uniform distribution in the interval [2,3,..,8].
We are using this section to draw numbers from [1...7] uniformly.
I hope it's correct theoretically.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
A = [ [6,7,8,9,1]
,[4,6,7,8,9]
,[1,4,6,7,8]
,[0,1,4,6,7]
,[0,1,4,6,6]
,[0,1,4,6,6]
,[0,1,4,6,6]
,[0,1,4,6,6]
]
- Sanjeev August 14, 2016