File: MSfUnifRand.html

package info (click to toggle)
libtsp 3r0-1
  • links: PTS
  • area: non-free
  • in suites: potato, woody
  • size: 5,096 kB
  • ctags: 1,798
  • sloc: ansic: 14,464; sh: 1,217; makefile: 182
file content (67 lines) | stat: -rw-r--r-- 1,828 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<HTML>
<HEAD>
<TITLE>TSP (libtsp/MS) - MSfUnifRand</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFACD">
<H2>MSfUnifRand</H2>
<HR>
<H4>Routine</H4>
<DL>
<DT>
double MSfUnifRand (void)
<DT>
void MSrandSeed (int seed)
</DL>
<H4>Purpose</H4>
<DL>
<DT>
Generate a uniformly distributed pseudo-random value
<DT>
Reseed the uniform pseudo-random value
</DL>
<H4>Description</H4>
This routine generates uniformly distributed pseudo-random numbers.  The
multiplicative congruential method is used to generate integer pseudo-random
numbers, is = (a*is) % m.  The values a=16807 and m=2147483647 are used.
These values have been shown to give good results.  Further, the values
generated are shuffled to give better serial correlation properties.  The
pseudo-random number generation routine is self initializing, but if a
different sequence of pseudo-random values is desired, the routine MSrandSeed
can be used to supply a starting (seed) value.
<P>
<DL>
<DT>
Reference:
<DD>
W. H. Press, S. A. Teukolsky, W. T. Vetterling, B. P. Flannery,
"Numerical Recipes in C" (2nd ed.) (p. 280), Cambridge University Press,
1992.
</DL>
<H4>Parameters</H4>
<DL>
<DT>
MSfUnifRand:
<DT>
&lt;-  double MSfUnifRand
<DD>
Uniform deviate with values between 0 and 1, exclusive of the end points.
<DT>
MSrandSeed:
<DT>
 -&gt; int seed
<DD>
Seed value.  A positive seed value sets the pseudo-random generation to a
new sequence.  A zero value sets the actual seed to a value based on the
current time.  The default sequence can be restarted by setting the seed
value to 12345.
</DL>
<H4>Author / revision</H4>
P. Kabal  Copyright (C) 1997
/ Revision 1.14  1997/10/14
<H4>See Also</H4>
<A HREF="MSfGaussRand.html">MSfGaussRand</A>
<P>
<HR>
Main Index <A HREF="../libtsp.html">libtsp</A>
</BODY>
</HTML>