I'm trying to figure out a random amount calculator but by rarity for example:
choices = [10,100,1000,10000] 10 being the most common, 100 more common, 1000 rare, and 10000 extremely rare
I've tried this
import random def getAmmounts(): choices = [10, 100, 1000, 10000] values = [random.choice(choices) for i in range(10)] return values Which returns a good amount of values but they're not that random 10000 appears quite often when it should almost hardly ever appear when I called on it the data what I received was:
[1000, 10000, 100, 1000, 10000, 10, 1000, 10000, 100, 100] Two 10000's are in there and hardly any 10 values when 10s and 100s should be most common then an occasional 1000 in the mix but hardly ever a 10000 value. Is there any way to set up a priority type function that does this? Some good example data of what this should return after all said in done would be:
[10,10,100,10,10,100,1000] And the occasional 10000 but it should be extremely rare, any idea on how to set this up?
10sshould be the most common so out of data with 20 values10should appear about 6-10 times but never exact the 100 value probably 3-5 the thousand once or twice but hardly ever the occurrence of a 10000 value10appears 80% of the time,100appears 10% of the time,1000appears 8% of the time, and10000appears 2% of the time. When assigning actual percentages to this, however, keep in mind how many timesgetAmounts()will run in real time, so that if a user can rungetAmounts()1000 times in a minute per your implementation of it, you will still have10000be a rare number (once or twice). This will require prob/stats math.10to appear6 out of 20 times. Readjusting this to be a statistics problem, notice that6 of 20can be expressed as a percentage ((6/20)*100 = 30%!)