On Mon, Mar 09, 2020 at 11:02:16PM +0100, Jeanette C. wrote: > Mar 9 2020, Ryan Jeffares has written: > ... > >What I need to know is, is it possible to > >ensure that a different integer is sent each time? There's a lot of > >repetition currently because the range of random numbers isn't very big. > ... > >if (ktrig = 1) then > > knote random 60, 63 > > knote = int(knote) > > event "i", "plucky", 0, 0.5, knote > >endif > ... > If you can spare the cycles: I'd create two varialbes, one koldnote and > knote. In a loop generate random numbers until knote != koldnote. Set > koldnote to the current knote then and continue with your event. Would > that do? > That's probably what I'd do. If you want a bit more 'cycling', you could use the random number as a 'step'. Something like: knote init 60 kstep random 1, 3 knote += int(kstep) if knote > 63 then knote -= 4 endif .... A quick test seems to work. (Beware non-integer random, though!) ...Or expand the random range and use a 'while' instead of 'if'... -- Pete -- Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here