Register to reply 
Given a random number from 03, return a random number from 06 
Share this thread: 
#1
Sep1811, 01:38 PM

P: 113

This is actually for a program, but the challenging part is really the math. So you're given a number 0, 1, 2, or 3 and the probability of getting each is the same. Now given this random number, I need to output a number 0, 1, 2, 3, 4, 5, or 6 but the probability of getting each number needs to be the same.
Can anyone point me in the right direction? 


#2
Sep1811, 02:41 PM

P: 2,499




#3
Sep1811, 03:38 PM

P: 113




#4
Sep1811, 07:38 PM

P: 113

Given a random number from 03, return a random number from 06
If anyone else has any other ideas, please share them. EDIT: Seems like the person above me deleted their post, making me seem crazy. 


#5
Sep1811, 08:07 PM

P: 800

You can randomize 0,1,2,3 twice to randomly express any number from 0 through 15 in base 4. Keep doing that till you get a number in the desired range. This procedure is not guaranteed to terminate, but each of 0 through 6 have the same probability of being chosen. Just a thought.



#6
Sep1811, 08:14 PM

P: 581

Suppose the program performs something such as floor(f(x)). Where f is a function by the mathematical definition of a function. We may get from this, a maximum of four unique outcomes, which is what we started with (four values of x). But we may actually end up with less. 


Register to reply 
Related Discussions  
MATLAB  random allocation of random number  Engineering, Comp Sci, & Technology Homework  1  
Sum of random number of random variables  Set Theory, Logic, Probability, Statistics  8  
Expectation and variance of a random number of random variables  Calculus & Beyond Homework  3  
Random Number  Precalculus Mathematics Homework  2  
Random Number  Set Theory, Logic, Probability, Statistics  0 