nrand

Functions

int main(int argc, char *argv[])

nrand [ option ]

  • -l int

    • output length \((1 \le L)\)

  • -m int

    • output order \((0 \le L - 1)\)

  • -s int

    • random seed

  • -u double

    • mean \((\mu)\)

  • -v double

    • variance \((0 \le \sigma^2)\)

  • -d double

    • standard deviation \((0 \le \sigma)\)

  • stdout

    • double-type random values

The output of this command is

\[ \begin{array}{ccccc} \epsilon(0), & \epsilon(1), & \ldots, & \epsilon(L - 1) \end{array} \]
where
\[ \epsilon(l) \sim \mathcal{N}(\mu, \sigma^2). \]
If the output length \(L\) is not given, an infinite random value sequence is generated.

In the below example, normal distributed random values of length 100 are generated:

nrand -l 100 > data.rnd
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

mseq

class NormalDistributedRandomValueGeneration : public sptk::RandomGenerationInterface

Generate random number based on normal distribution.

Public Functions

explicit NormalDistributedRandomValueGeneration(int seed)
Parameters:

seed[in] Random seed.

virtual void Reset()

Reset internal state.

virtual bool Get(double *output)

Get random number.

Parameters:

output[out] Random number.

Returns:

True on success, false on failure.

inline int GetSeed() const
Returns:

Random seed.