Percentage relative to 100 chance system

I have a system where I want to put the chance of something happening as a value and put that into a table. Ex. 3 things have a 25% chance of something happening and theres a 25% chance of nothing happening. I don’t know how to make math.random relative to 100 like that.

This community tutorial may help:


Let me know if this works

local rand = math.random(1,100)

if rand <= 25 then
	--1st chance
	elseif rand <= 50 then
		--2nd chance
	elseif rand <= 75 then
		--3rd chance
		--4th chance

The indentation might be weird because I typed this on dev forum lol

Is there a mathematical way I could make the same go with one thing having a chance of 0.5% and other 95%

local rand = math.random(1,100)

if rand <=  5 then
	--1st chance
	elseif rand <= 95 then
		-- 2nd chance 

That was an example, I meant like a equation to scale a number to work with the 1 in 100 system
Like how if I did rand 50 it would be one in 2, 33 would be 3, 25 would be 4