I was wondering if it's possible to have a random object that generates floating point numbers within a certain range in Pure Data Vanilla.
For example something that generates a float between 0.0 and 1.0?
I was wondering if it's possible to have a random object that generates floating point numbers within a certain range in Pure Data Vanilla.
For example something that generates a float between 0.0 and 1.0?
you might want to consider investigating the tag 'randomF'.
You could always generate a random number between 0 and 99 (then add 1 to the result to avoid 0) and then divide that number by 100. ex. 50/100 = 0.5
[random] only works with integers and outputs integers from 0 to N - 1 (float inputs are floored), but with a bit of math is possible to use it to get a random float between 0 and 1.
An integer N divided by an integer between 0 and N will aways result in a float between 0 and 1 (in Pure Data 1 / 0 == 0). Since [random] outputs integers from 0 to N - 1 the input to it should be N + 1 and the result is then divide by N. In the example below I have setup 1000 as default, giving 3 digits of precision.