I am currently working on an Android app and I am trying to get a random value from a database table that looks like this:
| ID | Score|
| 1 | 20 |
| 2 | 5 |
| 5 | 5 |
| 6 | 5 |
| 14 | 15 |
(lets assume these are the only values in the table)
I would like to get a random value from this table that has ID 1 40% of the time, ID 2 10% of the time, ID 5 10% of the time and so on…
If that is even possible, how would you go about it?
Given a
List<Integer>,add()each song indexscoretimes,Collections.shuffle()the list, and play in order. For better results, skip successive duplicates. More here.