Pvbrown : Pattern


Like Pbrown, except that you specify a pattern to calculate each step.


*new(lo, hi, step, length = inf)


lo, hi: Output value range.

step: A pattern outputting increments for Pvbrown's value. This value is multiplied randomly by +1 or -1; your pattern may output only positive numbers and the output values will increment and decrement randomly.

length: How many numbers to return.


Pvbrown(lo, hi, Pfunc({ maxStep.xrand }), inf) behaves exactly like Pbrown(lo, hi, maxStep, inf).



// no successive values are ever closer than 0.1 or farther than 0.4


p = Pvbrown(0.0, 1.0, Pwhite(0.1, 0.4, inf), inf).asStream;

p.nextN(10);

[ 0.25818018913269, 0.39941074848175, 0.69911118745804, 0.57881119251251, 0.33701903820038, 0.48915663957596, 0.65856301784515, 0.33630520105362, 0.6348381280899, 0.97818950414658 ]