I wish to obtain a random number, however i wish for a certain range of numbers to be more likley than others. For example, 0 would be very unlikley and probability of each number increaces till 4, then falls after that.

I don’t know how to achieve this.

It would be nice if I could define a function which represents probability for the given range, like a sine wave, where the higher the wave at a number, the greater the probability of that number being chosen.

The best I can think of is making a loop which fills a list with numbers, repeating more probable numbers more in the list, but this feels inefficient, especially for large numbers.

Simpily make a group of numbers equal certain values e.g if you were doing item drops and you want common items to appear alot you can make the number 1 actuall be 1-10 and then 2 would continue from 10 onwards. Then the total number of slots taken per number as to the total of all the numbers would be your actual probability of drawing that item ir rarity. (Each number would be an item)