| DirectCsound provides the score operator 'R' which creates a pseudo random value to be
used in any macro expression of the score.
This is the manual:
RANDOM NUMBER OPERATOR
R - retrieves a pseudo random value
syntax:
(amp R seed)
The operand amp is an amplitude factor that sets the range of random values from zero
to amp itself.
The operand seed allows the user to change the initial seed of the pseudo random
sequence. When seed is set to a non-zero value, R operator sets the seed, while with
seed = 0 it returns a normal random value. When seed is set to -1 the seed of pseudo
random sequence is obtained by the current timer value of the computer, allowing a
different pseudo random sequence each time Csound is run.
N.B. the unusual infix syntax can be transformed into a more familiar syntax by means
of macros:
#define RndSeed(seed) # (1 R ($seed)) #
#define Rand(min:max) # ( ($min) + ((($max)-($min)) R 0) ) #
In these examples $RndSeed( ) macro sets the seed, while $Rand( ) retrives a random
value inside the min-max interval.
Notice that in this case ':' character is used to separate macro arguments as in version
2.70 of DirectCsound. John Fitch has just sent me a message in which he says he intend to
use ' (apostroph) char to separate macro arguments in canonical version. So next version
of DirectCosound will use apostroph too.
--
Gabriel Maldonado
http://www.agora.stm.it/G.Maldonado/home2.htm
SONICMAN wrote:
>
> Randomizing numerical values in orc's or sco's HOW?
>
> What is the command that can be placed where an integer is normally
> placed to create random values ? In orc's..... and the command for use
> in sco's....?
>
> Thank you,
> SONICMAN=out |