Learn R Programming

TDMR (version 2.2)

makeTdmRandomSeed: Factory method to make a function generating pseudo-random random number seeds.

Description

Create first an object of type makeTdmRandomSeed and then call the returned value of that object (a function) as many times as you like. (It is necessary to create the function object first to have in its environment the private storage for the number of calls to that object.)

Usage

makeTdmRandomSeed(ID = 0)

Arguments

ID

[0] each random seed genarator with a different ID will generate different seeds. In this way it is possible that parallel jobs ID=0,1,2,... starting in the same second are initialized with different seeds and thus produce different results.

Value

A function object which can be invoked without any arguments and returns each time a different integer in 0...100001+nCall. This is true even if it is called many times within the same second (where Sys.time() will return the same integer). nCall is the number of calls to this function object.

See Also

tdmRandomSeed

Examples

Run this code
# NOT RUN {
tdmRandomSeed = makeTdmRandomSeed();
for (i in 1:10) print(c(as.integer(Sys.time()), tdmRandomSeed()));

# }

Run the code above in your browser using DataLab