blob: 84a12311a19ded7e7f73171034ffce45ba8cbfe4 (
plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin simulation::random n 0.1]
[keywords math]
[keywords {random numbers}]
[keywords simulation]
[keywords {statistical distribution}]
[copyright {2004 Arjen Markus <arjenmarkus@users.sourceforge.net>}]
[moddesc {Tcl Simulation Tools}]
[titledesc {Pseudo-random number generators}]
[category Mathematics]
[require Tcl [opt 8.4]]
[require simulation::random 0.1]
[description]
[para]
This package consists of commands to generate pseudo-random number
generators. These new commands deliver
[list_begin itemized]
[item]
numbers that are distributed normally, uniformly, according to a
Pareto or Gumbel distribution and so on
[item]
coordinates of points uniformly spread inside a sphere or a rectangle
[list_end]
For example:
[example {
set p [::simulation::random::prng_Normal -1.0 10.0]
}]
produces a new command (whose name is stored in the variable "p") that
generates normally distributed numbers with a mean of -1.0 and a
standard deviation of 10.0.
[section "PROCEDURES"]
The package defines the following public procedures for [emph discrete]
distributions:
[list_begin definitions]
[call [cmd ::simulation::random::prng_Bernoulli] [arg p]]
Create a command (PRNG) that generates numbers with a Bernoulli
distribution: the value is either 1 or 0, with a chance p to be 1
[list_begin arguments]
[arg_def float p] Chance the outcome is 1
[list_end]
[para]
[call [cmd ::simulation::random::prng_Discrete] [arg n]]
Create a command (PRNG) that generates numbers 0 to n-1 with equal
probability.
[list_begin arguments]
[arg_def int n] Number of different values (ranging from 0 to n-1)
[list_end]
[para]
[call [cmd ::simulation::random::prng_Poisson] [arg lambda]]
Create a command (PRNG) that generates numbers according to the Poisson
distribution.
[list_begin arguments]
[arg_def float lambda] Mean number per time interval
[list_end]
[list_end]
The package defines the following public procedures for [emph continuous] distributions:
[list_begin definitions]
[call [cmd ::simulation::random::prng_Uniform] [arg min ] [arg max]]
Create a command (PRNG) that generates uniformly distributed numbers
between "min" and "max".
[list_begin arguments]
[arg_def float min] Minimum number that will be generated
[arg_def float max] Maximum number that will be generated
[list_end]
[para]
[call [cmd ::simulation::random::prng_Exponential] [arg min] [arg mean]]
Create a command (PRNG) that generates exponentially distributed numbers
with a given minimum value and a given mean value.
[list_begin arguments]
[arg_def float min] Minimum number that will be generated
[arg_def float mean] Mean value for the numbers
[list_end]
[para]
[call [cmd ::simulation::random::prng_Normal] [arg mean] [arg stdev]]
Create a command (PRNG) that generates normally distributed numbers
with a given mean value and a given standard deviation.
[list_begin arguments]
[arg_def float mean] Mean value for the numbers
[arg_def float stdev] Standard deviation
[list_end]
[para]
[call [cmd ::simulation::random::prng_Pareto] [arg min] [arg steep]]
Create a command (PRNG) that generates numbers distributed according to
Pareto with a given minimum value and a given distribution steepness.
[list_begin arguments]
[arg_def float min] Minimum number that will be generated
[arg_def float steep] Steepness of the distribution
[list_end]
[para]
[call [cmd ::simulation::random::prng_Gumbel] [arg min] [arg f]]
Create a command (PRNG) that generates numbers distributed according to
Gumbel with a given minimum value and a given scale factor. The
probability density function is:
[example {
P(v) = exp( -exp(f*(v-min)))
}]
[list_begin arguments]
[arg_def float min] Minimum number that will be generated
[arg_def float f] Scale factor for the values
[list_end]
[para]
[call [cmd ::simulation::random::prng_chiSquared] [arg df]]
Create a command (PRNG) that generates numbers distributed according to
the chi-squared distribution with df degrees of freedom. The mean is 0
and the standard deviation is 1.
[list_begin arguments]
[arg_def float df] Degrees of freedom
[list_end]
[list_end]
The package defines the following public procedures for random point sets:
[list_begin definitions]
[call [cmd ::simulation::random::prng_Disk] [arg rad]]
Create a command (PRNG) that generates (x,y)-coordinates for points
uniformly spread over a disk of given radius.
[list_begin arguments]
[arg_def float rad] Radius of the disk
[list_end]
[para]
[call [cmd ::simulation::random::prng_Sphere] [arg rad]]
Create a command (PRNG) that generates (x,y,z)-coordinates for points
uniformly spread over the surface of a sphere of given radius.
[list_begin arguments]
[arg_def float rad] Radius of the disk
[list_end]
[para]
[call [cmd ::simulation::random::prng_Ball] [arg rad]]
Create a command (PRNG) that generates (x,y,z)-coordinates for points
uniformly spread within a ball of given radius.
[list_begin arguments]
[arg_def float rad] Radius of the ball
[list_end]
[para]
[call [cmd ::simulation::random::prng_Rectangle] [arg length] [arg width]]
Create a command (PRNG) that generates (x,y)-coordinates for points
uniformly spread over a rectangle.
[list_begin arguments]
[arg_def float length] Length of the rectangle (x-direction)
[arg_def float width] Width of the rectangle (y-direction)
[list_end]
[para]
[call [cmd ::simulation::random::prng_Block] [arg length] [arg width] [arg depth]]
Create a command (PRNG) that generates (x,y,z)-coordinates for points
uniformly spread over a block
[list_begin arguments]
[arg_def float length] Length of the block (x-direction)
[arg_def float width] Width of the block (y-direction)
[arg_def float depth] Depth of the block (z-direction)
[list_end]
[list_end]
[manpage_end]
|