random.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <html>
  2. <head>
  3. <title>Random</title>
  4. </head>
  5. <body bgcolor="FFFFFF">
  6. <h1><img align="center" src="../../../icons/random.gif" width="32" height="32">
  7. <em>Random</em></h1>
  8. <p><table>
  9. <tr><td><strong>Library:</strong></td>
  10. <td><a href="index.html">Memory</a></td></tr>
  11. <tr><td><strong>Introduced:</strong></td>
  12. <td>2.3.0</td></tr>
  13. <tr><td valign="top"><strong>Appearance:</strong></td>
  14. <td valign="top"><img src="../../../img-libs/random.png" width="34" height="44"></td></tr>
  15. </table></p>
  16. <h2>Behavior</h2>
  17. <p>This component iterates through a pseudorandom sequence of numbers, which
  18. steps forward to the following number in the sequence each time the clock is
  19. triggered while the component is enabled. Technically speaking, the algorithm
  20. used to compute the pseudorandom sequence is a linear
  21. congruential generator: Starting from a seed
  22. <var>r</var><sub><small>0</small></sub>, the following number
  23. <var>r</var><sub><small>1</small></sub> is the number</p>
  24. <center>
  25. <var>r</var><sub><small>1</small></sub> =
  26. (25,214,903,917 <var>r</var><sub><small>0</small></sub> + 11)
  27. mod 2<sup><small>48</small></sup>
  28. </center>
  29. <p>The next value <var>r</var><sub><small>2</small></sub>
  30. is computed from <var>r</var><sub><small>1</small></sub>
  31. using the same computation, and so forth. This sequence is of 48-bit numbers;
  32. the value seen from the component is the low-order bits as configured
  33. by its Data Bits attribute, after first throwing out the lower 12 bits of
  34. the current seed.</p>
  35. <p>Besides the clock input, the component also includes an <var>enable</var>
  36. input, which leads the clock input to be ignored when <var>enable</var> is 0,
  37. and the <var>reset</var> input, which resets the component's value asynchronously
  38. to the initial seed <var>r</var><sub><small>0</small></sub>.</p>
  39. <p>The initial seed is user-configurable. If it is configured at 0 (which is
  40. the default), then the seed is based on the current time; when instructed
  41. to reset through the <var>reset</var> input, the component computes a new
  42. seed based on the new current time.</p>
  43. <h2>Pins</h2>
  44. <dl>
  45. <dt>East edge, labeled <var>Q</var> (output, bit width matches Data Bits attribute)</dt>
  46. <dd>Outputs the value currently stored by the component.</dd>
  47. <dt>West edge, top pin, labeled with a triangle (input, bit width 1)</dt>
  48. <dd>Clock: At the instant that this is triggered as specified by the Trigger
  49. attribute, the component steps to the following number in its sequence.</dd>
  50. <dt>West edge, bottom pin (input, bit width 1)</dt>
  51. <dd>Enable: The component is enabled when this input is disconnected or 1;
  52. but if it is 0, then the clock input is ignored.</dd>
  53. <dt>South edge (input, bit width 1)</dt>
  54. <dd>Reset: When this is 1, the pseudorandom sequence asynchronously resets to
  55. the initial seed. (If seed is 0, this new seed should be different from the
  56. initial seed used previously.)</dd>
  57. </dl>
  58. <h2>Attributes</h2>
  59. <p>When the component is selected or being added,
  60. Alt-0 through Alt-9 alter its <q>Data Bits</q> attribute.</p>
  61. <dl>
  62. <dt>Data Bits</dt>
  63. <dd>The bit width of the value emitted by the component.</dd>
  64. <dt>Seed</dt>
  65. <dd>The starting value used for the pseudorandom sequence. If this is 0
  66. (the default), then the starting value is based on the time that the random
  67. sequence began.</dd>
  68. <dt>Trigger</dt>
  69. <dd>Configures how the clock input is interpreted. The value <q>rising edge</q>
  70. indicates that the component should update its value at the instant when the
  71. clock rises from 0 to 1. The <q>falling edge</q> value indicates that it should
  72. update at the instant the clock falls from 1 to 0.</dd>
  73. <dt>Label</dt>
  74. <dd>The text within the label associated with the component.</dd>
  75. <dt>Label Font</dt>
  76. <dd>The font with which to render the label.</dd>
  77. </dl>
  78. <h2>Poke Tool Behavior</h2>
  79. <p>None.</p>
  80. <h2>Text Tool Behavior</h2>
  81. <p>Allows the label associated with the component to be edited.</p>
  82. <p><a href="../index.html">Back to <em>Library Reference</em></a></p>
  83. </body>
  84. </html>