<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>y Statement (or Seed Statement)</title> <link rel="stylesheet" type="text/css" href="csound.css" /> <link rel="stylesheet" type="text/css" href="syntax-highlighting.css" /> <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /> <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" /> <link rel="up" href="ScoregensTop.html" title="Score Statements and GEN Routines" /> <link rel="prev" href="x.html" title="x Statement" /> <link rel="next" href="leftbrace.html" title="{ Statement" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">y Statement (or Seed Statement)</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="x.html">Prev</a> </td> <th width="60%" align="center">Score Statements and GEN Routines</th> <td width="20%" align="right"> <a accesskey="n" href="leftbrace.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="y"></a> <div class="titlepage"></div> <a id="IndexYStatement" class="indexterm"></a> <a id="IndexSeedStatement" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">y Statement (or Seed Statement)</span> </h2> <p>a — Set seed for random numbers. </p> </div> <div class="refsect1"> <a id="idm281472821026568"></a> <h2>Description</h2> <p> Set seed for random numbers, either from p1 or, if omitted, the clock. </p> </div> <div class="refsect1"> <a id="idm281472821025384"></a> <h2>Syntax</h2> <pre class="synopsis"><span class="command"><strong>y</strong></span> [p1]</pre> </div> <div class="refsect1"> <a id="idm281472821023368"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>p1</em></span> -- An integer value between 0 and 2<sup>32</sup> used as a new seed for random numbers. If omitted, the system clock value will be used instead. </p> </div> <div class="refsect1"> <a id="idm281472820992552"></a> <h2>Performance</h2> <p> The tilde symbol ˜ can be used in an expression wherever a number is permissible to use. Each ˜ will evaluate to a random value between zero (0) and one (1). If there is no y statement in the score, the pseudo-random generator will yield the same numbers in each performance. If a fixed seed is given, a different predictable series of pseudo-random numbers will be generated from this seed. If a y statement is used without p1, the system clock will be used as a seed, yielding a different series of pseudo-random numbers for each performance. </p> </div> <div class="refsect1"> <a id="idm281472820990728"></a> <h2>Examples</h2> <p> Here is an example of the y statement. It uses the file <a class="ulink" href="examples/y_statement.csd" target="_top"><em class="citetitle">y_statement.csd</em></a>. </p> <div class="example"> <a id="idm281472820988968"></a> <p class="title"> <strong>Example 1178. Example of the y statement.</strong> </p> <div class="example-contents"> <div class="refsect1"> <a id="idm281472683688184"></a> <pre class="programlisting"> <span class="nt"><CsoundSynthesizer></span> <span class="nt"><CsOptions></span> <span class="c1">; Select audio/midi flags here according to platform</span> <span class="c1">; Audio out Audio in No messages</span> -odac -iadc -d <span class="c1">;;;RT audio I/O</span> <span class="c1">; For Non-realtime ouput leave only the line below:</span> <span class="c1">; -o 0dbfs.wav -W ;;; for file output any platform</span> <span class="nt"></CsOptions></span> <span class="nt"><CsInstruments></span> <span class="c1">; Initialize the global variables.</span> <span class="vg">sr</span> <span class="o">=</span> <span class="mi">44100</span> <span class="vg">ksmps</span> <span class="o">=</span> <span class="mi">10</span> <span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">2</span> <span class="vg">0dbfs</span> <span class="o">=</span> <span class="mi">1</span> <span class="kd">instr</span> <span class="nf">1</span> <span class="nb">print</span> <span class="nb">p4</span> <span class="kd">endin</span> <span class="nt"></CsInstruments></span> <span class="nt"><CsScore></span> <span class="nb">y</span> <span class="nb">i</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</span> <span class="p">[</span><span class="o">~</span> <span class="o">*</span> <span class="mi">9</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]</span> <span class="nb">i</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">1</span> <span class="p">[</span><span class="o">~</span> <span class="o">*</span> <span class="mi">9</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]</span> <span class="nb">i</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">1</span> <span class="p">[</span><span class="o">~</span> <span class="o">*</span> <span class="mi">9</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]</span> <span class="nb">i</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">1</span> <span class="p">[</span><span class="o">~</span> <span class="o">*</span> <span class="mi">9</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]</span> <span class="nb">e</span> <span class="nt"></CsScore></span> <span class="nt"></CsoundSynthesizer></span> </pre> </div> </div> </div> <p><br class="example-break" /> Each time this example is run, different values between 1 and 10 will be displayed. The seed used will be displayed as well. </p> </div> <div class="refsect1"> <a id="idm281472820986952"></a> <h2>Credits</h2> <p>Author: John ffitch, 2014</p> <p>New in version 6.03</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="x.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="ScoregensTop.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="leftbrace.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">x Statement </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> { Statement</td> </tr> </table> </div> </body> </html>