~ubuntu-branches/ubuntu/trusty/gsl-ref-html/trusty

« back to all changes in this revision

Viewing changes to Random-number-generator-initialization.html

  • Committer: Bazaar Package Importer
  • Author(s): Dirk Eddelbuettel
  • Date: 2006-04-12 19:46:32 UTC
  • mfrom: (1.3.1 upstream) (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20060412194632-c9lodpl075pv9si3
Tags: 1.8-1
* New upstream release 1.8
* As with previous releases, the sources were obtained from the FSF web 
  pages by means of a wget call (c.f. the debian/rules target 'upstream')

* debian/control: Standards-Version increased to 3.6.2
* debian/copyright: Updated FSF address
* debian/rules: Set DH_COMPAT=4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html lang="en">
 
2
<head>
 
3
<title>Random number generator initialization - GNU Scientific Library -- Reference Manual</title>
 
4
<meta http-equiv="Content-Type" content="text/html">
 
5
<meta name="description" content="GNU Scientific Library -- Reference Manual">
 
6
<meta name="generator" content="makeinfo 4.8">
 
7
<link title="Top" rel="start" href="index.html#Top">
 
8
<link rel="up" href="Random-Number-Generation.html#Random-Number-Generation" title="Random Number Generation">
 
9
<link rel="prev" href="The-Random-Number-Generator-Interface.html#The-Random-Number-Generator-Interface" title="The Random Number Generator Interface">
 
10
<link rel="next" href="Sampling-from-a-random-number-generator.html#Sampling-from-a-random-number-generator" title="Sampling from a random number generator">
 
11
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
 
12
<!--
 
13
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 The GSL Team.
 
14
 
 
15
Permission is granted to copy, distribute and/or modify this document
 
16
under the terms of the GNU Free Documentation License, Version 1.2 or
 
17
any later version published by the Free Software Foundation; with the
 
18
Invariant Sections being ``GNU General Public License'' and ``Free Software
 
19
Needs Free Documentation'', the Front-Cover text being ``A GNU Manual'',
 
20
and with the Back-Cover Text being (a) (see below).  A copy of the
 
21
license is included in the section entitled ``GNU Free Documentation
 
22
License''.
 
23
 
 
24
(a) The Back-Cover Text is: ``You have freedom to copy and modify this
 
25
GNU Manual, like GNU software.''-->
 
26
<meta http-equiv="Content-Style-Type" content="text/css">
 
27
<style type="text/css"><!--
 
28
  pre.display { font-family:inherit }
 
29
  pre.format  { font-family:inherit }
 
30
  pre.smalldisplay { font-family:inherit; font-size:smaller }
 
31
  pre.smallformat  { font-family:inherit; font-size:smaller }
 
32
  pre.smallexample { font-size:smaller }
 
33
  pre.smalllisp    { font-size:smaller }
 
34
  span.sc    { font-variant:small-caps }
 
35
  span.roman { font-family:serif; font-weight:normal; } 
 
36
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
 
37
--></style>
 
38
</head>
 
39
<body>
 
40
<div class="node">
 
41
<p>
 
42
<a name="Random-number-generator-initialization"></a>
 
43
Next:&nbsp;<a rel="next" accesskey="n" href="Sampling-from-a-random-number-generator.html#Sampling-from-a-random-number-generator">Sampling from a random number generator</a>,
 
44
Previous:&nbsp;<a rel="previous" accesskey="p" href="The-Random-Number-Generator-Interface.html#The-Random-Number-Generator-Interface">The Random Number Generator Interface</a>,
 
45
Up:&nbsp;<a rel="up" accesskey="u" href="Random-Number-Generation.html#Random-Number-Generation">Random Number Generation</a>
 
46
<hr>
 
47
</div>
 
48
 
 
49
<h3 class="section">17.3 Random number generator initialization</h3>
 
50
 
 
51
<div class="defun">
 
52
&mdash; Function: gsl_rng * <b>gsl_rng_alloc</b> (<var>const gsl_rng_type * T</var>)<var><a name="index-gsl_005frng_005falloc-1373"></a></var><br>
 
53
<blockquote><p>This function returns a pointer to a newly-created
 
54
instance of a random number generator of type <var>T</var>. 
 
55
For example, the following code creates an instance of the Tausworthe
 
56
generator,
 
57
 
 
58
     <pre class="example">          gsl_rng * r = gsl_rng_alloc (gsl_rng_taus);
 
59
     </pre>
 
60
        <p>If there is insufficient memory to create the generator then the
 
61
function returns a null pointer and the error handler is invoked with an
 
62
error code of <code>GSL_ENOMEM</code>.
 
63
 
 
64
        <p>The generator is automatically initialized with the default seed,
 
65
<code>gsl_rng_default_seed</code>.  This is zero by default but can be changed
 
66
either directly or by using the environment variable <code>GSL_RNG_SEED</code>
 
67
(see <a href="Random-number-environment-variables.html#Random-number-environment-variables">Random number environment variables</a>).
 
68
 
 
69
        <p>The details of the available generator types are
 
70
described later in this chapter. 
 
71
</p></blockquote></div>
 
72
 
 
73
<div class="defun">
 
74
&mdash; Function: void <b>gsl_rng_set</b> (<var>const gsl_rng * r, unsigned long int s</var>)<var><a name="index-gsl_005frng_005fset-1374"></a></var><br>
 
75
<blockquote><p>This function initializes (or `seeds') the random number generator.  If
 
76
the generator is seeded with the same value of <var>s</var> on two different
 
77
runs, the same stream of random numbers will be generated by successive
 
78
calls to the routines below.  If different values of <var>s</var> are
 
79
supplied, then the generated streams of random numbers should be
 
80
completely different.  If the seed <var>s</var> is zero then the standard seed
 
81
from the original implementation is used instead.  For example, the
 
82
original Fortran source code for the <code>ranlux</code> generator used a seed
 
83
of 314159265, and so choosing <var>s</var> equal to zero reproduces this when
 
84
using <code>gsl_rng_ranlux</code>. 
 
85
</p></blockquote></div>
 
86
 
 
87
<div class="defun">
 
88
&mdash; Function: void <b>gsl_rng_free</b> (<var>gsl_rng * r</var>)<var><a name="index-gsl_005frng_005ffree-1375"></a></var><br>
 
89
<blockquote><p>This function frees all the memory associated with the generator
 
90
<var>r</var>. 
 
91
</p></blockquote></div>
 
92
 
 
93
   </body></html>
 
94