You are here: Symbol Reference > StatRandom Namespace > Functions > StatRandom.RandomUniform Function
Stats Master VCL
ContentsIndex
PreviousUpNext
StatRandom.RandomUniform Function

Uniform distribution random generator.

Pascal
procedure RandomUniform(const a: double; const b: double; const Results: TDenseMtxVec; Seed: Integer = -1);

This routine generates Result.Length pseudo random numbers, using the continuous uniform distribution with parameters a and b. The random numbers are stored in the Results vector. An exception is raised if Result vector is complex.

Generate 2000 random numbers by using the continuous uniform distribution with parameters a=-1 and b=1.

Uses MtxExpr, StatRandom;
procedure Example;
  var Res: Vector;
begin
  Res.Size(2000);
  RandomUniform(-1,1, Res);
end;
#include "MtxExpr.hpp"
#include "StatRandom.hpp"
void __fastcall Example()
{
  sVector Res;
  Res.Size(2000,false);
  RandomUniform(-1,1, Res,-1);
}
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!