1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <?xml-stylesheet type=
"text/xsl" href=
"formats/html.xsl"?>
4 <!-- This file is part of Shapes. -->
6 <!-- Shapes is free software: you can redistribute it and/or modify -->
7 <!-- it under the terms of the GNU General Public License as published by -->
8 <!-- the Free Software Foundation, either version 3 of the License, or -->
9 <!-- any later version. -->
11 <!-- Shapes is distributed in the hope that it will be useful, -->
12 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
13 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
14 <!-- GNU General Public License for more details. -->
16 <!-- You should have received a copy of the GNU General Public License -->
17 <!-- along with Shapes. If not, see <http://www.gnu.org/licenses/>. -->
19 <!-- Copyright 2015 Henrik Tidefelt -->
23 <namespace>..Shapes..Numeric..Random
</namespace>
25 <p>Random number generation.
</p>
28 <title><self /></title>
29 <up-link><parent-namespace /></up-link>
30 <base href=
<!--#expand-next-string-->"$(BASE)" />
31 <examples-home href=
<!--#expand-next-string-->"$(EXAMPLES)" />
32 <shapes-version number=
<!--#expand-next-string-->"$(SHAPES_VERSION)" />
34 <!--#include virtual="^/toc.xml" -->
39 <p>Besides the most elementary things such as initializing the random state and then sampling uniformly from a huge range of integer values,
<str-Shapes /> also comes with some more interesting distributions to sample from. Distributions are not represented explicitly, only implicitly as the non-pure functions that return an object of some kind while acting on a random state.
</p>
44 <system-binding name=
"newRandom">
45 <summary>Create random number generator seed
</summary>
48 <p>Create random number generator seed.
</p>
52 <arg identifier=
"seed">
55 <named-type name=
"Integer" />
56 <named-type name=
"ChronologicalTime" />
60 <arg identifier=
"size">
61 <type><named-type name=
"Integer" /></type>
62 <default><eq>32</eq></default>
66 <type><named-type name=
"RandomSeed" /></type>
68 <dynamic-references></dynamic-references>
70 <p>Creates random number generator seed based on
<arg name=
"seed" /> (agreed,
<em>seed
</em> being used with two slightly different meanings hre), with
<arg name=
"size" /> number of bits.
</p>
71 <p>A random number generator seed is simply the initial state of a random number generator, but note that it is not possible to draw samples using the seed, since the seed is a value and not a state. To draw samples, a
<named-statetype name=
"Random" /> must be spawned from the seed. Note that all
<named-statetype name=
"Random" /> spawned from the same seed will generate the same pseudo random number sequence.
</p>
77 <system-state name=
"randomdevice">
78 <type><named-statetype name=
"RandomDevice" /></type>
80 <p>Source of high quality random seeds.
</p>