Tool that outputs a random coordinates generator in n-th dimensions
Tool that outputs a random coordinates generator in n-th dimensions
GitHub: https://github.com/YujiSODE/nDRandom
Copyright (c) 2021 Yuji SODE \yuji.sode@gmail.com\
This software is released under the MIT License.
See LICENSE or http://opensource.org/licenses/mit-license.php
nDRandom
is a tool that outputs a random coordinates generator in n-th dimensions.
tclsh nDRandom.tcl name option min1 max1 division1 ?min2 max2 division2 ?... minN maxN divisionN??;
$name
: a keyword to determine output file name and its functions$option
: a keyword to determine output type$min1, $max1 and $division1
: data range$min2, $max2 and $division2 (, ..., $minN, $maxN and $divisionN)
: optional data ranges$division
: number of divided ranges that are not less than 2:
:setRange min max division;
: loads a variable range:
:output name ?option?;
: outputs a random coordinates generater in the current directory$min and $max
: minimum and maximum values$division
: number of divided ranges that are not less than 2$name
: a keyword to determine output file and its functions$option
: an optional keyword to determine output type, and default value is tcl
$option
keyword: output type
tcl: Tcl
js: JavaScript
The generated script is output in the current directory.
${name}_info()
and ${name}_random(double)
in math functions${name}_info()
: it returns preset data${name}_random(double)
: it returns a random coordinates in n-th dimensions$double
: a real number in range (0.0, 1.0)
{x1 dx1 x2 dx2 ... xn dxn}
where Xi = xi+c*dxi
and c
is a constantTo obtain random coordinates from a given space in n
-th dimensions.
Let variable elements be E
= (
e
0
,
e
1
,...,
e
n
)
where i
=0,...,
n
.
A range of a variable element e
i
is divided into d
i
intervals.
Let indices correspond to a specified intervals in divided elements as follows:IDX
=(
IDX
0
,
IDX
1
,...,
IDX
n
)
.
A coordinate element value can be estimated as follows:e
j
=
x
0
+
c
j
*
dx
,
where c
j
is constant,x
0
=
e
j
[
IDX
j
]
and dx
=(
e
j
max
-
e
j
min
)/
d
j
.
It requires Tcl 8.6+.
nDRandom.tcl
: main scriptndrandomOutput_tcl.tcl
: module to output as Tcl filendrandomOutput_js.tcl
: module to output as JavaScript file