Best way to make a weighted table for random level selection?

A simple system would be like this. Have a map with the level names and weighting:

348077-screenshot-3.jpg

Then just make an array of the names, inserting each name the given number of times ( making it more likely to occur ). Then choose one randomly:

If you don’t want a level to occur, you can just set it to zero before doing this:

348079-screenshot-4.jpg

4 Likes