I have a table like this:
ID chance
1 1
2 2
3 4
4 1
Now I need to choose a rand() from this table
SELECT * FROM table
ORDER BY RAND()
LIMIT 1
But ID #2 has double the chances to be selected compared to ID #1 AND 4. Likewise ID #3 has four times the chances to be selected compared to ID #1 AND 4.
Somewhat similar to lottery based on chance.