Random Processes

Probability Distributions

Probability is the likehood of occurrence of a given event, ratio of number of occurrences of that event to the total number of results of the random process. A probability distribution is a table that shows the likehood of occurrence of one of more events, where the probability of occurrence of a given event is expressed as a value between 0 and 1.

[continuous vs discrete distributions]

Random numbers... as normally generated in a computer are not really really random. They are the result of executing an algorithm, the output values can be considered statistically random if the algorithm is good enough. Normally the random number generator is seeded by a number, after that the numbers generated are predictable (each time we seed the generator with the same number it produces the same sequence of "random" numbers). For more details on how this is implemented in SuperCollider see the help for randomSeed

There are a bunch of functions in SuperCollider that we can use to generate random numbers. Some of them will work in the language level (sclang, the SuperCollider language interpreter - that's what you have direct access to from Emacs). Others will work in the server itself (scsynth, the SuperCollider sound server which gets OSC messages from the language or other sources) and are UGens (unit generators).

  • Language level random number generators include:

    • rand: generates uniformly distributed random numbers between zero and the argument (not including the argument).
      // random integers
      rand(10);
      10.rand;
      // random floating point values
      rand(10.0);
      10.0.rand;
      
    • linrand: probability increases from zero to the argument.
    • bilinrand: triangular distribution centered around zero.
    • sum3rand: quasi guassian.

    and more...

  • Server level random number generators include:

    Load the help file for Randomness for more options and tons of examples...

    [Distributions: uniform, linear, triangular, exponential...]

And also look up Patterns, there are many that return values according to different probability distributions.

The example file probability.sc has some examples of probability distributions.

And this one builds a probability function from scratch.