Java Code Examples for org.apache.commons.math3.random.Well1024a#setSeed()
The following examples show how to use
org.apache.commons.math3.random.Well1024a#setSeed() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LibMatrixDatagen.java From systemds with Apache License 2.0 | 6 votes |
/** * A matrix of random numbers is generated by using multiple seeds, one for each * block. Such block-level seeds are produced via Well equidistributed long-period linear * generator (Well1024a). For a given seed, this function sets up the block-level seeds. * * This function is invoked from both CP (RandCPInstruction.processInstruction()) * as well as MR (RandMR.java while setting up the Rand job). * * @param seed seed for random generator * @return Well1024a pseudo-random number generator */ public static Well1024a setupSeedsForRand(long seed) { long lSeed = (seed == DataGenOp.UNSPECIFIED_SEED ? DataGenOp.generateRandomSeed() : seed); LOG.trace("Setting up RandSeeds with initial seed = "+lSeed+"."); Random random=new Random(lSeed); Well1024a bigrand=new Well1024a(); //random.setSeed(lSeed); int[] seeds=new int[32]; for(int s=0; s<seeds.length; s++) seeds[s]=random.nextInt(); bigrand.setSeed(seeds); return bigrand; }
Example 2
Source File: LibMatrixDatagen.java From systemds with Apache License 2.0 | 6 votes |
/** * A matrix of random numbers is generated by using multiple seeds, one for each * block. Such block-level seeds are produced via Well equidistributed long-period linear * generator (Well1024a). For a given seed, this function sets up the block-level seeds. * * This function is invoked from both CP (RandCPInstruction.processInstruction()) * as well as MR (RandMR.java while setting up the Rand job). * * @param seed seed for random generator * @return Well1024a pseudo-random number generator */ public static Well1024a setupSeedsForRand(long seed) { long lSeed = (seed == DataGenOp.UNSPECIFIED_SEED ? DataGenOp.generateRandomSeed() : seed); LOG.trace("Setting up RandSeeds with initial seed = "+lSeed+"."); Random random=new Random(lSeed); Well1024a bigrand=new Well1024a(); //random.setSeed(lSeed); int[] seeds=new int[32]; for(int s=0; s<seeds.length; s++) seeds[s]=random.nextInt(); bigrand.setSeed(seeds); return bigrand; }