diff options
Diffstat (limited to 'sonics/array_tools.udo')
-rwxr-xr-x | sonics/array_tools.udo | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sonics/array_tools.udo b/sonics/array_tools.udo new file mode 100755 index 0000000..69ea2b9 --- /dev/null +++ b/sonics/array_tools.udo @@ -0,0 +1,27 @@ +#ifndef UDO_ARRAYTOOLS +#define UDO_ARRAYTOOLS ## +/* + Array tools + Slim excerpt for Partial Emergence + + This file is part of the SONICS UDO collection by Richard Knight 2021 + License: GPL-2.0-or-later + http://1bpm.net +*/ + + +/* + Get a random value from an array + + ivalue arr_random iarray[] + + ivalue selected value + iarray[] array to evaluate +*/ +opcode arr_random, i, i[] + iarray[] xin + ivalue = iarray[round(random(0, lenarray(iarray) - 1))] + xout ivalue +endop + +#end |