makerandom  set up a periodic randomnumber generator for control purposes,
using a pfieldhandle connect to an Instrument parameter
Synopsis
pfieldhandle = makerandom("type", frequency, min, max[, seed])
Parameters inside the [brackets] are optional.
Description
makerandom
returns a pfieldhandle that will deliver data periodically
from an internal RTcmix randomnumber generator. The period is determined
by the frequency argument, and the random numbers will lie
within the range set by the min and max arguments.
The randomnumbers will be generated according the the randomnumber
distribution specified in the "type" string argument. These
distributions are identical to the ones decribed in the
maketable "random"
table construction command. The
optional seed argument allows the user to specify a particular
seed value for the psuedorandom algorithm used by the randomnumber
generator. The active control rate (set via
control_rate) must be the
same for makerandom and the instrument that uses the makerandom pfieldhandle.
Many of the arguments for makerandom may themselves
also be pfieldhandles.
Arguments
 type

This string value (i.e. enclosed in "double quotes" in the scorefile)
determines the type of randomnumber distribution to use in generating
the periodic values. The different types currently supported are:
 "even"/"linear"  randomly select numbers between
min and max.
 "low"  randomly select numbers between
min and max, but with a higher probability
of choosing numbers nearer the min value.
 "high"  randomly select numbers between
min and max, but with a higher probability
of choosing numbers nearer the max value.
 "triangle"  randomly select numbers between
min and max, but with the probability of
choosing a value determined by a triangular curve with the
apex at the midpoint between the min and max
values. In other words, numbers near either min or
max will have a very low probability of being generated,
but numbers halfway between will have a high
probability of being chosen.
 "gaussian"  randomly select numbers between
min and max, but with the probability of
choosing a value determined using a
Gaussian
('normal'; 'bell curve') probability distribution with the
apex at the midpoint between the min and max
values. Similar to how the "triangle" specifier operates.
 "cauchy"  randomly select numbers between
min and max, but with the probability of
choosing a value determined using a
Cauchy
function with the
apex at the midpoint between the min and max
values. Similar to how the "triangle" and "gaussian"
specifiers operate.
 "prob"  Mara Helmuth's configurable probability
distribution. This has a slightly different syntax:
makerandom("prob", frequency, min, max, mid, tight[, seed])
min and max set the range within which the
random numbers fall, as before. mid sets the midpoint
of the range, which is used when tight is not 1.
tight governs the degree to which the random numbers
adhere either to the midpoint set by mid or to
the extremes of the range set by min and max:
tight effect

0 only the min and max values appear
1 even distribution
> 1 numbers cluster ever more tightly around mid
100 almost all numbers are equal to mid
frequency
The frequency (in Hz) determines the rate at which random values will
be generetated through the pfieldhandle
This should be less than the
reset
rate.
min
max
These two arguments define the range of random values that will be produced
by the randomnumber generator through the pfieldhandle.
min will set
the minimum value of the range, and max
will set the upper bound.
seed
This optional argument sets the 'seed' (or initial value) for the
pseudorandom number algorithm used by RTcmix. Each seed value
will generate a unique sequence of "random" numbers.
If the seed argument is 0, then the 'seed' for the psuedorandom number
algorithm comes from the microsecond system clock, otherwise the value
of seed is used as the 'seed'.
If no seed argument is present, the 'seed' used is 0 (i.e. the 'seed'
will come from the system clock).
Examples
pitch1 = makerandom("low", 10, 8.00, 8.11)
pitch2 = makerandom("high", 15, 8.00, 8.11)
wave = maketable("wave", 1000, 1.0, 0.2, 0.1)
WAVETABLE(0, 4.9, 15000, pitch1, 0.0, wave)
WAVETABLE(0, 4.9, 15000, pitch2, 1.0, wave)
This scorefile uses two randomnumber PField generators, one
operating at 10 Hz (10 values/second) and the other at
15 Hz (15 values/second) to control the pitch of two
WAVETABLE
notes, one in the left channel and one in the right. The pitch
(in octave.pitchclass notation) is coming directly
from the randomnumber pfieldhandles, pitch1 and pitch2.
The range of these randomnumber generators is set to produce
values within the octave 8.00 to 8.11 (middle "C" to the "B"
above middle "C").
See Also
maketable,
makeconnection,
makeLFO,
makefilter,
makeconverter,
makemonitor,
irand,
srand,
trand,
random,
rand,
pickrand,
pickwrand,
spray_init,
get_spray,
