betarand

Name

betarand --  Beta distribution random number generator (positive values only).

Description

Beta distribution random number generator (positive values only). This is an x-class noise generator.

Syntax

ar betarand krange, kalpha, kbeta
ir betarand krange, kalpha, kbeta
kr betarand krange, kalpha, kbeta

Performance

krange -- range of the random numbers (0 - krange).

kalpha -- alpha value. If kalpha is smaller than one, smaller values favor values near 0.

kbeta -- beta value. If kbeta is smaller than one, smaller values favor values near krange.

If both kalpha and kbeta equal one we have uniform distribution. If both kalpha and kbeta are greater than one we have a sort of Gaussian distribution. Outputs only positive numbers.

For more detailed explanation of these distributions, see:

  1. C. Dodge - T.A. Jerse 1985. Computer music. Schirmer books. pp.265 - 286

  2. D. Lorrain. A panoply of stochastic cannons. In C. Roads, ed. 1989. Music machine . Cambridge, Massachusetts: MIT press, pp. 351 - 379.

Examples

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

Example 15-1. Example of the betarand opcode.

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

; Instrument #1.
instr 1
  ; Generate a number between 0 and 1 with a 
  ; uniform distribution.
  ; krange = 1
  ; kalpha = 1
  ; kbeta = 1

  i1 betarand 1, 1, 1

  print i1
endin
/* betarand.orc */
        
/* betarand.sco */
; Play Instrument #1 for one second.
i 1 0 1
e
/* betarand.sco */
        
Its output should include lines like:
instr 1:  i1 = 24583.412
      

See Also

bexprnd, cauchy, exprand, gauss, linrand, pcauchy, poisson, trirand, unirand, weibull

Credits

Author: Paris Smaragdis
MIT, Cambridge
1995

Example written by Kevin Conder.