randh
Generates random numbers and holds them for a period of time.
Syntax
ares randh xamp, xcps [, iseed] [, isize] [, ioffset]
kres randh kamp, kcps [, iseed] [, isize] [, ioffset]
Initialization
iseed (optional, default=0.5) -- seed value for the recursive pseudo-random formula. A value between 0 and +1 will produce an initial output of kamp * iseed. A negative value will cause seed re-initialization to be skipped. A value greater than 1 will seed from system time, this is the best option to generate a different random sequence for each run.
isize (optional, default=0) -- if zero, a 16 bit number is generated. If non-zero, a 31-bit random number is generated. Default is 0.
ioffset (optional, default=0) -- a base value added to the random result. New in Csound version 4.03.
Performance
kamp, xamp -- range over which random numbers are distributed.
kcps, xcps -- the frequency which new random numbers are generated.
The internal pseudo-random formula produces values which are uniformly distributed over the range -kamp to +kamp. rand will thus generate uniform white noise with an R.M.S value of kamp / root 2.
The remaining units produce band-limited noise: the kcps and xcps parameters permit the user to specify that new random numbers are to be generated at a rate less than the sampling or control frequencies. randh will hold each new number for the period of the specified cycle.
Examples
Here is an example of the randh opcode. It uses the file randh.csd.
The example will produce the following output:
i1 50.00000
i1 50.00305
i1 97.68677
i1 -44.25354
i1 -61.56006
i1 -75.91248
i1 67.57202
i1 12.83875
i1 5.39551
i1 -95.18738
WARNING: Seeding from current time 684387922
i2 -13.81226
i2 -16.49475
i2 69.51904
i2 35.04944
i2 47.47925
i2 63.25378
i2 -59.61914
i2 50.93079
i2 -6.46362
i2 5.89294