2 embedInStream { |inval|
3 var localLength = length.value(inval),
4 pat = Pwhite(lo, hi, localLength);
5 ^min(pat, pat).embedInStream(inval)
10 embedInStream { |inval|
11 var localLength = length.value(inval),
12 pat = Pwhite(lo, hi, localLength);
13 ^max(pat, pat).embedInStream(inval)
18 embedInStream { |inval|
19 var localLength = length.value(inval),
20 pat = Pwhite(lo, hi, localLength);
21 ^((pat + pat) * 0.5).embedInStream(inval)
26 var <>lo, <>hi, <>prob1, <>prob2, <>length;
28 *new{ arg lo = 0.0, hi = 1.0, prob1 = 1, prob2 = 1, length = inf;
29 ^super.newCopyArgs(lo, hi, prob1, prob2, length);
32 storeArgs { ^[lo, hi, prob1, prob2, length] }
34 embedInStream { arg inval;
35 var loStr = lo.asStream;
36 var hiStr = hi.asStream;
37 var prob1Str = prob1.asStream;
38 var prob2Str = prob2.asStream;
41 length.value(inval).do({
42 var sum = 2, temp, rprob1, rprob2;
43 rprob1 = prob1Str.next(inval);
44 rprob2 = prob2Str.next(inval);
45 if(rprob1.isNil or: { rprob2.isNil }) { ^inval };
46 rprob1 = rprob1.reciprocal;
47 rprob2 = rprob2.reciprocal;
48 loVal = loStr.next(inval);
49 hiVal = hiStr.next(inval);
50 if(loVal.isNil or: { hiVal.isNil }) { ^inval };
53 temp = 1.0.rand ** rprob1;
54 sum = temp + (1.0.rand ** rprob2);
57 inval = (((temp/sum) * (hiVal - loVal)) + loVal).yield;
64 var <>mean, <>spread, <>length;
66 *new{arg mean = 0.0, spread = 1.0, length = inf;
67 ^super.newCopyArgs(mean, spread, length);
70 storeArgs{ ^[mean, spread, length] }
72 embedInStream { arg inval;
73 var meanStr = mean.asStream;
74 var spreadStr = spread.asStream;
75 var meanVal, spreadVal;
76 length.value(inval).do({
78 meanVal = meanStr.next(inval);
79 spreadVal = spreadStr.next(inval);
80 if(meanVal.isNil or: { spreadVal.isNil }) { ^inval };
85 inval = ((spreadVal * (ran * pi).tan) + meanVal).yield;
92 var <>mean, <>dev, <>length;
94 *new{ arg mean = 0.0, dev = 1, length = inf;
95 ^super.newCopyArgs(mean, dev, length);
98 storeArgs{ ^[mean, dev, length] }
100 embedInStream{arg inval;
101 var meanStr = mean.asStream;
102 var devStr = dev.asStream;
104 length.value(inval).do({
105 devVal = devStr.next(inval);
106 meanVal = meanStr.next(inval);
107 if(meanVal.isNil or: { devVal.isNil }) { ^inval };
108 inval = ((((-2*log(1.0.rand)).sqrt * sin(2pi.rand)) * devVal) + meanVal).yield;
116 var <>mean, <>length;
117 *new{arg mean = 1, length = inf;
118 ^super.newCopyArgs(mean, length);
120 storeArgs{ ^[mean, length] }
121 embedInStream{ arg inval;
122 var meanStr = mean.asStream;
123 length.value(inval).do({
124 var inc, test, temp, meanVal = meanStr.next(inval);
125 if(meanVal.isNil) { ^inval };
128 temp = exp(meanVal.neg);
133 test = test * 1.0.rand;
142 *new { arg lo=0.0001, hi=1.0, length=inf;
143 ^super.newCopyArgs(lo, hi, length)
145 storeArgs { ^[ lo, hi, length ] }
146 embedInStream { arg inval;
147 var loStr = lo.asStream;
148 var hiStr = hi.asStream;
150 length.value(inval).do({
151 hiVal = hiStr.next(inval);
152 loVal = loStr.next(inval);
153 if(hiVal.isNil or: { loVal.isNil }) { ^inval };
154 inval = exprand(loVal, hiVal).yield;