First of all im new with coding in Java. I'm coding a program that is calculating random probabilities with a total sum of 100%. For example: Participant 1: 20% chance to win. Participant 2 : 25% chance to win. Participant 3: 45% chance to win. Participant 4: 10% chance to win.
How do I actually pick a winnner? My guess was to check if a random number (0-100) lies between an interval. For example: Participant 1 has a range between 0 and 20. Participant 2 has a range between 20 and 45 and so on.
But how do I actually implement this in Java? Thanks for your help!