aboutsummaryrefslogtreecommitdiff
path: root/sonics/array_tools.udo
diff options
context:
space:
mode:
authorRichard <richard@1bpm.net>2022-10-04 00:17:55 +0100
committerRichard <richard@1bpm.net>2022-10-04 00:17:55 +0100
commitdecb2dc0e9f1167d5cd8fb4d455305be6b9fdfbe (patch)
tree9a9a586bbb6268e52290c017ec95d3f672822980 /sonics/array_tools.udo
downloadcsd-partialemergence-decb2dc0e9f1167d5cd8fb4d455305be6b9fdfbe.tar.gz
csd-partialemergence-decb2dc0e9f1167d5cd8fb4d455305be6b9fdfbe.tar.bz2
csd-partialemergence-decb2dc0e9f1167d5cd8fb4d455305be6b9fdfbe.zip
initial
Diffstat (limited to 'sonics/array_tools.udo')
-rwxr-xr-xsonics/array_tools.udo27
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