The object info node allows you to get a number between 0 and 1, but is there a way to get something like 5-15? I’m trying to randomize material properties for particles, but the changes are either way too subtle or way too drastic and/or in a completely wrong range.
Bonus question, is there a way to randomize mesh displacement for particles?
Firstly because it doesn’t work - you can’t limit 0 to 5 and 1 to 15. You’d have to expand the range.
Secondly if you multiply the random number generator with 100 for instance, you have numbers 0 to 100.
Limiting the result to 5 and 15 for instance would result in:
0 < n <= 5, so 5 digits to generate 5
5 < n <=15, so 10 digits to generate results from 6…15
15 < n < 100, so 85 digits to generate 15.
So the chance that the pseudorandom number generated would turn out to be anything else than 15 is rather slim.
The only correct thing to do would be to use modulo.
n = 0…1
lower = 5
upper = 15
value = ((n*1000) % ((upper-lower)+1) + lower
This would generate numbers from 5 to 15 with an equal chance.