birnd
Prev | Orchestra Opcodes and Operators | Next

## birnd

birnd — Returns a random number in a bi-polar range.

## Description

Returns a random number in a bi-polar range.

## Syntax

    birnd(x) (init- or control-rate only)

Where the argument within the parentheses may be an expression. These value converters sample a global random sequence, but do not reference seed. The result can be a term in a further expression.

## Performance

Returns a random number in the bipolar range -x to x. rnd and birnd obtain values from a global pseudo-random number generator, then scale them into the requested range. The single global generator will thus distribute its sequence to these units throughout the performance, in whatever order the requests arrive.

## Examples

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

Example 48. Example of the birnd opcode.

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

    ; Instrument #1.
    instr 1
      ; Generate a random number from -1 to 1.
      i1 = birnd(1)
      print i1
    endin
    /* birnd.orc */

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

Its output should include lines like:

    instr 1:  i1 = 0.947
    instr 1:  i1 = -0.721

## See Also

rnd

## Credits

Author: Barry L. Vercoe
MIT
Cambridge, Massachussetts
1997

Example written by Kevin Conder.

Prev | Up | Next
biquada | Home | bqrez