Home › Forums › General › Programming › How to make a parameters Randomiser button? › Reply To: How to make a parameters Randomiser button?
i am also looking at how to have a random generator.
i found the following in a matrix1000 panel:
(this is my own adaptation, and i don’t know if it is
working optimally yet)
random=function()
-- This stops issues during panel bootup
if panel:getRestoreState() or panel:getProgramState() then return end
--
math.randomseed(Time.getMillisecondCounterHiRes())
modul = panel:getModulatorByName("hexlist")
rnd = math.random(0,15)
modul:setModulatorValue(rnd,false,false,false)
end
ok, so that is my own hack of what i saw, and should return
something between 0 and 15 for the ‘hexlist’ modulator.
but it is behaving weirdly: sometimes it just acts as an
up-counter/incrementor, and at others seems to be not
random enough. i think it is something to do with the
timing interval of the seed. Possemo says something
about it here:
in other words, the ‘seeding’ is too slow to give
random results. i don’t fully understand it yet,
but i have messed around with seed and random
modules in synthedit – and seen that if it is not
done right, you do not get random, you can get repeating
patterns.
nb:(if Possemo is reading) interested in how you are
getting parameters by ‘group ownership’ rather than
byName, with repetition for each item. i have not
reproduced that successfully yet.(different context etc.)