I have these four variables:
local RarityBasic = 0.4 -- The probability.
local RarityRare = 0.3
local RarityLegendary = 0.2
local RarityExotic = 0.1
Where the number is the probability. I want a way of randomly choosing one of them taking into account the probability that each thing has.
The output would be something like:
print("Rarity: "..Rarity)
>> Rarity: Basic
How would I do this?

4 comments
Use math.random and covert each number to a string. For different raritys, have several numbers equal one string
math.random isn't actually random.
You could create a random number from 0 ~100 and use that as a %?
How would I manipulate the randomly generated number though?