Hi there,
is it possible to generate a random number (best between 0 and 255) with a script?
Reason: I want to set a DMX fixture with a random value every beat by OS2L.
is it possible to generate a random number (best between 0 and 255) with a script?
Reason: I want to set a DMX fixture with a random value every beat by OS2L.
Inviato Fri 17 Feb 23 @ 12:19 pm
No, there's no random seed generator.
However, I guess you could query something like volume (get_level), and multiply it with something like seconds elapsed to get a pseudorandom seed.
However, I guess you could query something like volume (get_level), and multiply it with something like seconds elapsed to get a pseudorandom seed.
Inviato Fri 17 Feb 23 @ 2:09 pm
That sounds like an interesting experiment. A common way to generate (pseudo-)random values is to indeed take some kind of variable (as you suggest, get_level, or something else like get_cpu) and then mutiply that by a very large number and then use the MOD operator. But I can't find which operators are supported in VDJ script... (e.g. MOD).
Inviato Sun 19 Feb 23 @ 2:23 pm
param_mod is a thing
Inviato Sun 19 Feb 23 @ 8:31 pm
Although the required operations are indeed there (param_multiply, param_add, param_mod) it looks like the most basic random number generators require operations on 32-bit unsigned integers, and because vdj internally uses floating point for the param_ operations they don't seem to get the right result when i tried some.
Inviato Mon 20 Feb 23 @ 5:54 am