Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9843

How can I pick an item given it's range, from a number within that range

$
0
0

https://docs.google.com/spreadsheets/d/1GoaRd0xJZLPPaXJhmcfEQgW_GNsQyyy_Xa51G-nixqc/edit?usp=sharing

Please view the spreadsheet.
Essentially I have a list of albums, with a rating. What I want to do is pick a random album, but weighted on the ratings.

My working theory: I've then created a cumulative total from those ratings, so now each album has a range from which it can be chosen. I created a random number between 1 and the cumulative total - this number will correspond to an album based on what range it falls into. Look at the sheet if this is confusing you.

What I need to do now is translate that random number into the actual album name. So it needs to figure out which row the random number corresponds to and then pick the album column. Can anyone help?


Viewing all articles
Browse latest Browse all 9843

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>