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

« back to all changes in this revision

Viewing changes to Auxiliary-random-number-generator-functions.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>Auxiliary random number generator functions - 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="Sampling-from-a-random-number-generator.html#Sampling-from-a-random-number-generator" title="Sampling from a random number generator">
 
10
<link rel="next" href="Random-number-environment-variables.html#Random-number-environment-variables" title="Random number environment variables">
 
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="Auxiliary-random-number-generator-functions"></a>
 
43
Next:&nbsp;<a rel="next" accesskey="n" href="Random-number-environment-variables.html#Random-number-environment-variables">Random number environment variables</a>,
 
44
Previous:&nbsp;<a rel="previous" accesskey="p" href="Sampling-from-a-random-number-generator.html#Sampling-from-a-random-number-generator">Sampling from a random number generator</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.5 Auxiliary random number generator functions</h3>
 
50
 
 
51
<p>The following functions provide information about an existing
 
52
generator.  You should use them in preference to hard-coding the generator
 
53
parameters into your own code.
 
54
 
 
55
<div class="defun">
 
56
&mdash; Function: const char * <b>gsl_rng_name</b> (<var>const gsl_rng * r</var>)<var><a name="index-gsl_005frng_005fname-1380"></a></var><br>
 
57
<blockquote><p>This function returns a pointer to the name of the generator. 
 
58
For example,
 
59
 
 
60
     <pre class="example">          printf ("r is a '%s' generator\n",
 
61
                  gsl_rng_name (r));
 
62
     </pre>
 
63
        <p class="noindent">would print something like <code>r is a 'taus' generator</code>. 
 
64
</p></blockquote></div>
 
65
 
 
66
<div class="defun">
 
67
&mdash; Function: unsigned long int <b>gsl_rng_max</b> (<var>const gsl_rng * r</var>)<var><a name="index-gsl_005frng_005fmax-1381"></a></var><br>
 
68
<blockquote><p><code>gsl_rng_max</code> returns the largest value that <code>gsl_rng_get</code>
 
69
can return. 
 
70
</p></blockquote></div>
 
71
 
 
72
<div class="defun">
 
73
&mdash; Function: unsigned long int <b>gsl_rng_min</b> (<var>const gsl_rng * r</var>)<var><a name="index-gsl_005frng_005fmin-1382"></a></var><br>
 
74
<blockquote><p><code>gsl_rng_min</code> returns the smallest value that <code>gsl_rng_get</code>
 
75
can return.  Usually this value is zero.  There are some generators with
 
76
algorithms that cannot return zero, and for these generators the minimum
 
77
value is 1. 
 
78
</p></blockquote></div>
 
79
 
 
80
<div class="defun">
 
81
&mdash; Function: void * <b>gsl_rng_state</b> (<var>const gsl_rng * r</var>)<var><a name="index-gsl_005frng_005fstate-1383"></a></var><br>
 
82
&mdash; Function: size_t <b>gsl_rng_size</b> (<var>const gsl_rng * r</var>)<var><a name="index-gsl_005frng_005fsize-1384"></a></var><br>
 
83
<blockquote><p>These functions return a pointer to the state of generator <var>r</var> and
 
84
its size.  You can use this information to access the state directly.  For
 
85
example, the following code will write the state of a generator to a
 
86
stream,
 
87
 
 
88
     <pre class="example">          void * state = gsl_rng_state (r);
 
89
          size_t n = gsl_rng_size (r);
 
90
          fwrite (state, n, 1, stream);
 
91
     </pre>
 
92
        </blockquote></div>
 
93
 
 
94
<div class="defun">
 
95
&mdash; Function: const gsl_rng_type ** <b>gsl_rng_types_setup</b> (<var>void</var>)<var><a name="index-gsl_005frng_005ftypes_005fsetup-1385"></a></var><br>
 
96
<blockquote><p>This function returns a pointer to an array of all the available
 
97
generator types, terminated by a null pointer. The function should be
 
98
called once at the start of the program, if needed.  The following code
 
99
fragment shows how to iterate over the array of generator types to print
 
100
the names of the available algorithms,
 
101
 
 
102
     <pre class="example">          const gsl_rng_type **t, **t0;
 
103
          
 
104
          t0 = gsl_rng_types_setup ();
 
105
          
 
106
          printf ("Available generators:\n");
 
107
          
 
108
          for (t = t0; *t != 0; t++)
 
109
            {
 
110
              printf ("%s\n", (*t)-&gt;name);
 
111
            }
 
112
     </pre>
 
113
        </blockquote></div>
 
114
 
 
115
   </body></html>
 
116