Given a random number from 0-3, return a random number from 0-6

Click For Summary
The discussion focuses on generating a uniform random number from 0 to 6 based on an initial random number from 0 to 3, ensuring equal probability for each outcome. Participants suggest using mathematical functions, such as floor or ceiling, to manipulate the initial number and achieve the desired range. There is a debate over whether the output needs to be random or simply uniform, with some clarifying that uniformity implies equal probability for each result. One proposed method involves generating two random integers from 0 to 3 to create a broader range of outcomes. The conversation highlights the complexity of ensuring equal probabilities while transforming the initial input.
gsingh2011
Messages
115
Reaction score
1
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?
 
Physics news on Phys.org
gsingh2011 said:
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?

You need to specify how the outcome of the first round will affect the second round. Otherwise you just have two independent outcomes a,b. Then the probability of any pair is 1/28.
 
Last edited:
SW VandeCarr said:
You need to specify how the outcome of the first round will affect the second round. Otherwise you just have two independent outcomes a,b. Then the probability of any pair is 1/28.

Well the relationship is that after being given this random number from 0-3, you need to perform mathematical operations (functions such as floor and ceiling are allowed) to arrive at a new number from 0-6. Now if you performed these same steps for the random input number many times, you would end up with the numbers from 0-6 an approximately equal number of times (probability of getting each number is the same). Does that clarify the problem?
 
MisterX said:
These functions are for use with non-integer numbers.
I thought division might be involved, resulting in non-integers.

However, if the output needn't be random, but only uniform
What's the difference? I thought if something was random, the probability for each result would be the same (uniform).

You could do something like generate a second 0-3 integer pseudorandomly and determine the 0-6 integer using the two integers. You could have the program do something somewhat similar if you are able to get two 0-3 random integers.
I'll try it out, see if I can come up with anything.

If anyone else has any other ideas, please share them.

EDIT: Seems like the person above me deleted their post, making me seem crazy.
 
Last edited:
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.
 
gsingh2011 said:
I thought division might be involved, resulting in non-integers.
.

Suppose x is a random integer from 0-3.

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.
 
Hello, I'm joining this forum to ask two questions which have nagged me for some time. They both are presumed obvious, yet don't make sense to me. Nobody will explain their positions, which is...uh...aka science. I also have a thread for the other question. But this one involves probability, known as the Monty Hall Problem. Please see any number of YouTube videos on this for an explanation, I'll leave it to them to explain it. I question the predicate of all those who answer this...
There is a nice little variation of the problem. The host says, after you have chosen the door, that you can change your guess, but to sweeten the deal, he says you can choose the two other doors, if you wish. This proposition is a no brainer, however before you are quick enough to accept it, the host opens one of the two doors and it is empty. In this version you really want to change your pick, but at the same time ask yourself is the host impartial and does that change anything. The host...
I'm taking a look at intuitionistic propositional logic (IPL). Basically it exclude Double Negation Elimination (DNE) from the set of axiom schemas replacing it with Ex falso quodlibet: ⊥ → p for any proposition p (including both atomic and composite propositions). In IPL, for instance, the Law of Excluded Middle (LEM) p ∨ ¬p is no longer a theorem. My question: aside from the logic formal perspective, is IPL supposed to model/address some specific "kind of world" ? Thanks.