| 1 | |
| 2 | <refentry id="y"> |
| 3 | <indexterm id="IndexYStatement"><primary>y statement</primary></indexterm> |
| 4 | <indexterm id="IndexSeedStatement"><primary>seed statement</primary></indexterm> |
| 5 | <refmeta> |
| 6 | <refentrytitle>y Statement (or Seed Statement)</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>a</refname> |
| 11 | <refpurpose> |
| 12 | Set seed for random numbers. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Set seed for random numbers, either from p1 or, if omitted, the clock. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis><command>y</command> [p1]</synopsis> |
| 26 | </refsect1> |
| 27 | |
| 28 | <refsect1> |
| 29 | <title>Initialization</title> |
| 30 | <para> |
| 31 | <emphasis>p1</emphasis> -- An integer value between 0 and 2<superscript>32</superscript> |
| 32 | used as a new seed for random numbers. If omitted, the system clock value will be used instead. |
| 33 | </para> |
| 34 | </refsect1> |
| 35 | |
| 36 | <refsect1> |
| 37 | <title>Performance</title> |
| 38 | <para> |
| 39 | The tilde symbol ˜ can be used in an expression wherever a number is permissible |
| 40 | to use. Each ˜ will evaluate to a random value between zero (0) and one (1). |
| 41 | If there is no y statement in the score, the pseudo-random generator will yield |
| 42 | the same numbers in each performance. If a fixed seed is given, a different |
| 43 | predictable series of pseudo-random numbers will be generated from this seed. |
| 44 | If a y statement is used without p1, the system clock will be used as a seed, |
| 45 | yielding a different series of pseudo-random numbers for each performance. |
| 46 | </para> |
| 47 | </refsect1> |
| 48 | |
| 49 | <refsect1> |
| 50 | <title>Examples</title> |
| 51 | <para> |
| 52 | Here is an example of the y statement. It uses the file <ulink url="examples/y_statement.csd"><citetitle>y_statement.csd</citetitle></ulink>. |
| 53 | <example> |
| 54 | <title>Example of the y statement.</title> |
| 55 | <xi:include href="examples-xml/y_statement.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 56 | </example> |
| 57 | Each time this example is run, different values between 1 and 10 will be displayed. |
| 58 | The seed used will be displayed as well. |
| 59 | </para> |
| 60 | </refsect1> |
| 61 | |
| 62 | <refsect1> |
| 63 | <title>See Also</title> |
| 64 | <para> |
| 65 | <link linkend="ScoreStatements"><citetitle>Score Statements</citetitle></link> |
| 66 | </para> |
| 67 | </refsect1> |
| 68 | |
| 69 | <refsect1> |
| 70 | <title>Credits</title> |
| 71 | <para>Author: &namejohn;, 2014</para> |
| 72 | <para>New in version 6.03</para> |
| 73 | </refsect1> |
| 74 | </refentry> |