# 2.2.3.19.43 vectorbase::Uniform

## Description

Fill vector with pseudo random numbers between 0 and 1.

Fill vector with value randomly picked from the given vectorbase object

## Syntax

BOOL Uniform( int nSize, int nSeed = 0 )
BOOL Uniform( int nSize, vectorbase & v, int nFillFrom = -1 )

## Parameters

nSize
[input]number of values
nSeed
[input]seed for the random sequence. Using a value of 0 will generate a different sequence each time this function is called. The same senquence of numbers will be generated each time if the function is called with a fixed seed value larger than 0.
nSize
[input]the number of elements to be filled
v
[input]vectorbase object to offer the value
nFillFrom
[input]start index of vector to fill values to

## Return

Returns TRUE on success or FALSE on failure.

TRUE on success, otherwise FALSE

## Examples

EX1

void vectorbase_Uniform_ex1()
{
// Declare a vector of size 20
vector vec(20);

// Fill with random numbers
BOOL bRet = vec.Uniform(vec.GetSize());

// Output the values
for( int ii=0; ii<vec.GetSize(); ii++ )
printf("vec[%d]=%f\n", ii, vec[ii])
}

## Remark

Fill vector with pseudo random numbers between 0 and 1 from a uniform distribution. This method is similar to the LabTalk Uniform function. If this method is used on an integer vector, then the resulting vector will be filled with 0s.