DatasetObject::Uniform

Description

Repeat the items in vsSource with random order to genereate a series data.

Syntax

BOOL Uniform(int nSize, vector<string>& vsSource, int i1 = -1)

Parameters

nSize
[input] the size of the data series.
vsSource
[input] the vector to store the items used to repeat.
i1
[input] the begin index of vector.

Return

TRUE for success, else return FALSE.

Examples

void datasetobject_uniform_ex1()
{
        Worksheet wks;
        wks.Create(); // create a empty wks with default template
        
        Column col(wks, 0);      
        vector& vec = col.GetDataObject();
        vec.SetSize(100);
        vec = 0; // initialize the vector with 0.
        
        DatasetObject dsObj(col);
        vector<string> vsSource = {"aa", "bb", "cc"};     
        dsObj.Uniform(10, vsSource, 1);        
}

Remark

See Also

DatasetObject::Pattern

header to Include

origin.h