YujiSODE / nDRandom

Tool that outputs a random coordinates generator in n-th dimensions

Home Page:https://yujisode.github.io/nDRandom/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nDRandom

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


conceptIMG_nDRandom

  • It can generates a random coordinates in n-th dimensions employing a single random numbers.
  • Generated elements in random coordinate may show spurious correlation, but they have no correlation with each other.
  • Generated elements are not cryptographically secure.

1. Description

nDRandom is a tool that outputs a random coordinates generator in n-th dimensions.

shell

  • 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

Tcl

  • ::nDRandom::setRange min max division;: loads a variable range
  • ::nDRandom::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

Available keyword for $option

keyword: output type
tcl: Tcl
js: JavaScript

Generated script

The generated script is output in the current directory.

  • Generated script format: ${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)
    • output coordinates: {x1 dx1 x2 dx2 ... xn dxn} where Xi = xi+c*dxi and c is a constant

To obtain random coordinates from a given space in n-th dimensions.
Let variable elements be E= (e0,e1,...,en) where i=0,...,n.
A range of a variable element ei is divided into di intervals.
Let indices correspond to a specified intervals in divided elements as follows:
IDX=(IDX0,IDX1,...,IDXn).

A coordinate element value can be estimated as follows:
ej=x0+cj*dx,
where cj is constant,
x0=ej[IDXj]
and dx=(ejmax-ejmin)/dj.

3. Scripts

It requires Tcl 8.6+.

main script

modules

4. Library list

About

Tool that outputs a random coordinates generator in n-th dimensions

https://yujisode.github.io/nDRandom/

License:MIT License


Languages

Language:Tcl 53.4%Language:HTML 26.0%Language:JavaScript 20.1%Language:CSS 0.5%