I believe that the much simpler way is to simply use "maybe"<br><br>float sampleRate<br><br>if (maybe)<br>   1.0 => sampleRate;<br>else<br>    1.5 => sampleRate<br><br><div class="gmail_quote">2010/9/3 Mark Cerqueira <span dir="ltr"><<a href="mailto:mark.cerqueira@gmail.com">mark.cerqueira@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style="word-wrap: break-word;">Tim,<div>You can use rand2f to do this....</div><div><br>
</div><div><div style="margin: 0px;"><font color="#0034ff"><div style="margin: 0px;"><span style="color: rgb(0, 52, 255);">float</span> sampleRate;</div><div style="margin: 0px; color: rgb(0, 52, 255); min-height: 17px;">
<br></div><div style="margin: 0px;"><span style="color: rgb(0, 52, 255);">if </span>(std.rand2f(<span style="color: rgb(222, 146, 15);">0</span>.<span style="color: rgb(222, 146, 15);">0</span>, <span style="color: rgb(222, 146, 15);">1</span>.<span style="color: rgb(222, 146, 15);">0</span>) < <span style="color: rgb(222, 146, 15);">0</span>.<span style="color: rgb(222, 146, 15);">5</span>)</div>
<div style="margin: 0px;">    <span style="color: rgb(222, 146, 15);">1</span>.<span style="color: rgb(222, 146, 15);">0</span> => sampleRate;</div><div style="margin: 0px; color: rgb(0, 52, 255);">else</div><div style="margin: 0px;">
    <span style="color: rgb(222, 146, 15);">1</span>.<span style="color: rgb(222, 146, 15);">5</span> => sampleRate;</div><div style="margin: 0px;"><br></div><div style="margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium;">I ran this section of code 1,000,000 times in my program doing this chunk of code every 1 sample and:</span></div>
<div style="margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium;"><br></span></div><div style="margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium;">1. ChucK did not make my computer explode :)</span></div>
<div style="margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium;">2. The rate was set to 1.0 500,814 times and 1.5 499,186 times (pretty good distribution)</span></div><div style="margin: 0px;">
<br></div><div style="margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium;">Hope that helps!</span><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium;"> </span></div>
<div style="margin: 0px;"><br></div><div style="margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium;">Best,</span></div><div style="margin: 0px;"><font color="#000000" face="Helvetica"><span style="font-size: medium;">Mark</span></font></div>
</font></div></div><div><br><div><div><div></div><div class="h5"><div>On Sep 3, 2010, at 8:21 AM, Timothy Leonido wrote:</div><br></div></div><blockquote type="cite"><div><div></div><div class="h5">Hallo, <div><br></div><div>
Once again, sorry for the rudimentary questions, but I can't seem to find the correct language for a very simple function: Instead of using Std.rand2f( ) for fluctuating volume or buf.rate, I'd like to simply have an either/or option. Play sample at a rate of 1.0 <i>or </i>1.5, randomly. The moses function (in pure data) was useful for this. Direction to the appropriate helpful would also be appreciated.</div>

<div><br></div><div><br></div><div><br></div><div>Thanks so much, </div><div><br></div><div>Tim </div></div></div>
_______________________________________________<br>chuck-users mailing list<br><a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br><a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</blockquote></div><br></div></div><br>_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>David M<br>