From decb2dc0e9f1167d5cd8fb4d455305be6b9fdfbe Mon Sep 17 00:00:00 2001 From: Richard Date: Tue, 4 Oct 2022 00:17:55 +0100 Subject: initial --- sonics/array_tools.udo | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 sonics/array_tools.udo (limited to 'sonics/array_tools.udo') 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 -- cgit v1.2.3