Random Sources

Part of the success of the Fraccut engine is the direct result of a somewhat overlooked detail in how it handled random calls: Fraccut used deterministic randomness.  In fact, it was the only engine to make use of a source of randomness other than direct calls to a pseudorandom generator.  Rather, it first stored large arrays of random numbers (drawn from the random generator) and then accessed them based on an index that could be reset and incremented at will.  This resulted in subtle repetitions that make Fraccut seem far more coherent.  Since the method of using random sources outside of pseudorandom generators clearly provides benefits, I am exploring more general and flexible implementations of randomness for future plugins.

I have designed an abstract class for use with c++ plugins that will allow functions and objects to request random numbers without necessarily knowing from what kind of source the numbers come.  This way, an object such as a phrase (in the case of contour grammar) or a space (in the case of Fraccut) can be "bound" to a specific random source - a derivation of the abstract random source class - that will handle the details of randomness.  It is the object's responsability to keep up with an index.  The object must provide an index to the random source when requesting a random number.  This way, the random source may choose to be deterministic, assigning a single, definite output to each input state.  The random source may even be coherent, meaning that indices close in value should produce related output while indices far apart in value should be nearly independent.  On the other hand, it is still, of course, possible to simply neglect the index and draw from a pseudorandom generator in the event that determinism is not required for the task.

The trick in this technique lies in clever usage of indices.  For example, in Fraccut, a parent block may be given an index.  Now, when the engine cuts the block, it may choose to assign the new block(s) indices that correspond to the parent block's index modulated by a given amount.  This way, the new blocks will draw from an identical random stream (if the source is deterministic) as their parent, giving rise to relationships that can, as in the case of Fraccut, seem quite intricate.

In future plugins, I will explore better ways to generate random numbers in hopes of gaining more coherence.