randomi
Prev | Orchestra Opcodes and Operators | Next

## randomi

randomi — Generates a user-controlled random number series with interpolation between each new number.

## Description

Generates a user-controlled random number series with interpolation between each new number.

## Syntax

    ares randomi kmin, kmax, acps

    kres randomi kmin, kmax, kcps

## Performance

kmin -- minimum range limit

kmax -- maximum range limit

kcps, acps -- rate of random break-point generation

The randomi opcode is similar to randi but allows the user to set arbitrary minimum and maximum values.

## Examples

Here is an example of the randomi opcode. It uses the files randomi.orc and randomi.sco.

Example 317. Example of the randomi opcode.

    /* randomi.orc */
    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    ; Instrument #1.
    instr 1
      ; Choose a random frequency between 220 and 440.
      ; Generate new random numbers at 10 Hz.
      kmin init 220
      kmax init 440
      kcps init 10

      k1 randomi kmin, kmax, kcps

      printks "k1 = %f\\n", 0.1, k1
    endin
    /* randomi.orc */

    /* randomi.sco */
    ; Play Instrument #1 for one second.
    i 1 0 1
    e
    /* randomi.sco */

Its output should include lines like:

    k1 = 220.000000
    k1 = 414.226196
    k1 = 284.101074

## See Also

randi, random, randomh

## Credits

Author: Gabriel Maldonado

Example written by Kevin Conder.

Prev | Up | Next
randomh | Home | rbjeq