From Cycling '74 Wiki
Revision as of 22:18, 7 August 2013 by Cory Metcalf (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


random online refpage

Using the random object

The random object generates a random value from 0 to 1 less than the value specified by the argument.

random Tutorials

The random object shows up in many tutorials and example patches. The following tutorials represent particularly useful techniques for using the object.

All of the CyclistMusic patches use random in multiple places within the patches. These are a great way to get a sense of how to use the object in general and more specifically, how to incorporate randomization into timing, note selection, and other musical vocabularies.

  • ./examples/sequencing-looping/CyclistMusic

./examples/legacy-examples/synths/fm-surfer-folder/fm-surfer.maxpat. The FM Surfer patch has a wealth of more complex uses of random. Within the fm-surfer-folder you will find the abstractions that are used in the patch. The ones that begin with rand- deal with different random functions.

random Tips and Workarounds

The output of random is always an integer and always outputs values from 0 to 1 less than the range specified by the argument. In many cases you will want to convert these values to floating point or to offset them in some way, whether it is to control vizzie objects, OpenGL parameters or coordinates, to generate negative values, or even just to start from 1 instead of 0. In many cases you can do this by simply re-scaling the values using a scale object or by adding an offset with the + object.

-- Pasted Max Patch, click to expand. --

This patch shows a simple way to use the random object to create an adaptive probability system. Similar to the functionality of decide, it chooses between two possible states, however, each time one state is selected it is more likely to be selected again.

-- Pasted Max Patch, click to expand. --

This may seem obvious, but when converting the output of random to floats, you can use large ranges to increase resolution.

-- Pasted Max Patch, click to expand. --

Random tries to create true random numbers within its range, which means that a repeat number is just as likely as any other number. For random numbers without repetition, look at urn.

If you are working in VIZZIE and want some random behaviors, look at vz.jittr, which introduces noise into any signal (within the standard vizzie data range of 0. - 1.) and vz.wandr, which emulates the behavior of drunk (also in the 0. - 1. data range.)

Third-Party Max externals similar to the random object listing for the random object

People who looked at/used this object also looked at....

Errors or Clarifications

(please list things that you believe to be errors or omissions from the existing refpage)