Code Monkey home page Code Monkey logo

randnumgen's Introduction

RandNumGen

Random Number Generator for some specific statistic distributions, including uniform, normal, etc.

License

The MIT License

Author

Tche LIU, [email protected], USTC

Compile

Although the statically compiled binary executable file rngen is available on Linux platform, you can compile the source file rngen.F90 on your system as follow:

$ gfortran rngen.F90 -o rngen

or

$ ifort rngen.F90 -DIFORT -o rngen

Examples

Help info. can be obtained by ./rngen -h:

Usage: rngen [-v IsVerbose] [-s IsSilent] [ -uni unia,unib | -nor norMu,norSigma ] [-m MulprScale] [-i IncrmValue] [-p DecimalNum] [-d Len2Dim]
  [IsVerbose     ]: print verbose warning and help information (T) or not (F).
  [IsSilent      ]: print configure parameter (F) or not (T).
  [unia,unib     ]: uniform distribution on the interval [unia, unib].
  [norMu,norSigma]: normal distribution with mean norMu and variance norSigma.
  [MulprScale    ]: original random number multiplied by MulprScale to scale.
  [IncrmValue    ]: intermediary random number added by IncrmValue to shift.
  [DecimalNum    ]: number of the decimal places to be reserved.
  [Len2Dim       ]: dimension lengths of 2-D output array: dim1_len,dim2_len

As shown above, to generate a $5\times 3$ array of uniform-distributed random number on the interval $[10, 20]$ and reserve two decimal places, we can run:

$ ./rngen -uni 1,2 -m 10 -p 2 -d 5,3

Similarly, to generate a $1\times 20$ array of normal-distributed random number with $\mu=10$ and $\sigma=1$, we can run:

$ ./rngen -nor 10,1 -d 1,20

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.