Hello. I’m using RandonFloatInRange to vary the pitch of a sound effect. It works well, but I would like to understand it better.
How many numbers would appear to the right of the decimal point in these random numbers? Is that set by the range numbers you give the expression?
In other words, if my range is (1.5, 2.5), are number like 1.5654 and 2.2344 possible, or are the random numbers limited to 1.6, 1.7, 1.8 etc. because of the numbers I provided?
So if I gave the range (1.6666, 2.9999), I would get numbers like 2.1234. Is that right?
Edit: Seems I can limit the decimal places of the random number using round(number, number), like this:
roundTo(RandomFloatInRange(1.0, 1.5),1)
The ‘,1’ is how many decimal digits you want. So this expression can only produce 1.0, 1.1, 1.2, 1.3, 1.4 and 1.5.
Edit 2: @suh My apologies: after your reply I realised I could test it myself using a text object to show the random numbers. Thanks for nudging me along in the right direction.