1

If we have a random integer generator (like a dice: $\{1,2,3,4,5,6\}$) with a few possible outcomes, is there a way to generate a uniformly distributed with more possible outcomes?(for example: $\{1,2,3,4,\dots,100\}$)

I think I should group bigger set into groups with same number of members and choose between them? Like:

$\{1,2,...,36\} \Rightarrow \{\{1,\dots,6\},\{7,\dots,12\},\dots,\{31,\dots,36\}\}$ random number one $= 3 \Rightarrow \{13,14,15,16,17,18\}$ random number two $= 2 \Rightarrow \{14\}$

But is there any mathematical operation $(+,/,*,-,\log, \dots)$ to do with random number one and two?

Ramil
  • 1,938
Nemexia
  • 173

2 Answers2

2

It appears that what you want is 6((random 1)-1) + (random 2 -1).

What you want to do is use the results of consecutive rolls to produce a string (e.g. 1546). Subtract one from every value to get a number in base 6. (e.g. 0435). Then, convert it to base 10, e.g. $5 + 3\times 6 + 4\times 6^2 + 0 \times 6^3$. You can check this is a bijection.

1

Suppose you have one die, and you are trying to generate a random number from $1 .. N$

You can at least divide the numbers into two sets, odd and even. If you roll an even, call it 0 and if you roll an odd call it 1. In this way you can generate a random binary string of arbitrary length. Now roll it $\log_2 N + 1$ times. If the resulting binary number is $\le N$ then you accept that as the outcome. If not, start over.

By no means is this the most efficient way to generate this distribution but it just shows it's possible.

Mark
  • 6,038