source: project/random-swb/tags/1.2/random-swb-eggdoc.scm @ 4979

Last change on this file since 4979 was 4979, checked in by Ivan Raikov, 13 years ago

Release 1.2

File size: 5.2 KB
Line 
1
2(use eggdoc)
3
4(define doc
5  `((eggdoc:begin
6     (name "swb-random")
7     (description "A random number generator based on the subtract-with-borrow (SWB) method.")
8     (author (url "mailto:iraikov@ece.gatech.edu" "Ivan Raikov"))
9
10     (history 
11      (version "1.2" "Fixed the .meta file to include the documentation")
12      (version "1.1" "License upgrade to GPL v3")
13      (version "1.0" "Initial release"))
14
15     (requires)
16
17     (usage "(require-extension swb-random)")
18
19     (download "swb-random.egg")
20
21     (documentation
22     
23      (p "The swb-random library is a port of the SML/NJ implementation of "
24         "a random number generator using the subtract-with-borrow (SWB) method "
25         "described by Marsaglia and Zaman in " 
26         (pre "A New Class of Random Number Generators, "
27              "Ann. Applied Prob. 1(3), 1991, pp. 462-480. "))
28
29      (p "The SWB generator implemented in this library is a 30-bit generator with lags 48 and 8. "
30         "It has period " (tt "(2^1487 - 2^247)/105") " or about " (tt "10^445") 
31         ". The SWB generator acts locally like a lagged Fibonacci generator "
32         "and thus it is combined with a linear congruential generator "
33         (tt "(48271*a)mod(2^30-1)") ". ")
34
35      (subsection "Procedures"
36
37                  (procedure "make-swb-random-state:: CONG-SEED SHR-SEED -> SWB-STATE"
38                             (p "Creates an initial seed array and generator state. "
39                                "The seed vector is filled one bit at a time by taking "
40                                "the leading bit of the xor of a shift register and a "
41                                "congruential sequence.  The congruential generator is "
42                                (tt "(c*48271) mod (2^30 - 1)") ". The shift register "
43                                "generator is " (tt "c(I + L18)(I + R13)") ".  "
44                                "The same congruential generator continues to be used as a "
45                                "mixing generator with the SWB generator."))
46
47                  (procedure "swb-random!:: SWB-STATE -> FIXNUM"
48                             (p "Computes the next random number. The output from the SWB "
49                                "generator is xor-ed with a number from the linear "
50                                "congruential generator. This procedure modifies its input "
51                                "argument. "))
52
53                  (procedure "swb-random-natural!:: SWB-STATE -> FIXNUM"
54                             (p "Computes the next random number and returns its absolute value. "
55                                "The output from the SWB generator is xor-ed with a number from the "
56                                "linear congruential generator. This procedure modifies its input "
57                                "argument. "))
58
59                  (procedure "swb-random-real!:: SWB-STATE -> FLONUM"
60                             (p "Computes the two next random numbers and uses them to construct "
61                                "a real number of the range " (tt "[0..1]") ". "
62                                "The output from the SWB generator is xor-ed with a number from the "
63                                "linear congruential generator. This procedure modifies its input "
64                                "argument. "))
65
66                  (procedure "swb-random-range!:: (FIXNUM * FIXNUM) -> (SWB-STATE -> FIXNUM)"
67                             (p "Given a range " (tt "[i..j], 0 <= i < j") ",  returns a "
68                                "procedure that takes in a random number generator state and "
69                                "computes a random number in the given range. "
70                                "The output from the SWB generator is xor-ed with a number from the "
71                                "linear congruential generator. The returned procedure modifies its input "
72                                "argument. "))
73
74                  (procedure "swb-random:: SWB-STATE -> SWB-STATE * FIXNUM"
75                             (p "Computes the next random number. The output from the SWB "
76                                "generator is xor-ed with a number from the linear "
77                                "congruential generator. The new generator state is returned along "
78                                "with the random number. "))
79
80                  (procedure "swb-random-natural:: SWB-STATE -> SWB-STATE * FIXNUM"
81                             (p "Computes the next random number and returns its absolute values. "
82                                "The output from the SWB generator is xor-ed with a number from the linear "
83                                "congruential generator. The new generator state is returned along "
84                                "with the random number. "))
85
86                  (procedure "swb-random-real:: SWB-STATE -> SWB-STATE * FLONUM"
87                             (p "Computes the two next random numbers and uses them to construct "
88                                "a real number of the range " (tt "[0..1]") ". "
89                                "The output from the SWB generator is xor-ed with a number from the "
90                                "linear congruential generator. The new generator state is returned along "
91                                "with the random number. "))
92
93                  (procedure "swb-random-range:: (FIXNUM * FIXNUM) -> (SWB-STATE -> SWB-STATE * FIXNUM)"
94                             (p "Given a range " (tt "[i..j], 0 <= i < j") ",  returns a "
95                                "procedure that takes in a random number generator state and "
96                                "computes a random number in the given range. "
97                                "The output from the SWB generator is xor-ed with a number from the "
98                                "linear congruential generator. The new generator state is returned along "
99                                "with the random number. "))))
100                 
101
102     (examples)
103
104     (license
105      "Copyright 2007 Ivan Raikov.
106
107This program is free software: you can redistribute it and/or modify
108it under the terms of the GNU General Public License as published by
109the Free Software Foundation, either version 3 of the License, or (at
110your option) any later version.
111
112This program is distributed in the hope that it will be useful, but
113WITHOUT ANY WARRANTY; without even the implied warranty of
114MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
115General Public License for more details.
116
117A full copy of the GPL license can be found at
118<http://www.gnu.org/licenses/>."))))
119
120(if (eggdoc->html doc) (void))
Note: See TracBrowser for help on using the repository browser.