Ingreso rápido:  

Forum: General Discussion

Tema: Can you generate random values?
bibi-bPRO InfinityMember since 2022
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.

 

Mensajes 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.
 

Mensajes Fri 17 Feb 23 @ 2:09 pm
SepatroPRO InfinityMember since 2019
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).
 

Mensajes Sun 19 Feb 23 @ 2:23 pm
locoDogPRO InfinityModeratorMember since 2013
param_mod is a thing
 

Mensajes Sun 19 Feb 23 @ 8:31 pm
AdionPRO InfinityCTOMember since 2006
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.
 

Mensajes Mon 20 Feb 23 @ 5:54 am