SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
NestedUniformScrambling.java
1/*
2 * Class: NestedUniformScrambling
3 * Description: performs Owen's nested uniform scrambling
4 * Environment: Java
5 * Software: SSJ
6 * Copyright (C) 2016 David Munger, Pierre L'Ecuyer and Universite de Montreal
7 * Organization: DIRO, Universite de Montreal
8 * @author
9 * @since
10
11 * SSJ is free software: you can redistribute it and/or modify it under
12 * the terms of the GNU General Public License (GPL) as published by the
13 * Free Software Foundation, either version 3 of the License, or
14 * any later version.
15
16 * SSJ is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20
21 * A copy of the GNU General Public License is available at
22 <a href="http://www.gnu.org/licenses">GPL licence site</a>.
23 */
24package umontreal.ssj.hups;
25
26import umontreal.ssj.rng.RandomStream;
27import java.lang.IllegalArgumentException;
28
45
46 private RandomStream stream;
47 private int numBits;
48
53 this(null);
54 }
55
62 this(stream, 0);
63 }
64
76 public NestedUniformScrambling(RandomStream stream, int numBits) {
77 this.stream = stream;
78 this.numBits = numBits;
79 }
80
82 return stream;
83 }
84
85 public void setStream(RandomStream stream) {
86 this.stream = stream;
87 }
88
92 public void setNumBits(int numBits) {
93 this.numBits = numBits;
94 }
95
103 public void randomize(PointSet p) {
104 if (p instanceof CachedPointSet) {
106 if (cp.getParentPointSet() instanceof DigitalNetBase2) {
107 ((DigitalNetBase2) cp.getParentPointSet()).nestedUniformScramble(stream, cp.getArray(), numBits);
108 return;
109 }
110 }
111 throw new IllegalArgumentException(
112 "NestedUniformScrambling" + " can only randomize a CachedPointSet of a DigitalNetBase2");
113 }
114
118 public String toString() {
119 return "Nested uniform scrambling";
120 }
121}
This container class caches a point set by precomputing and storing all the points locally in an arra...
PointSet getParentPointSet()
Returns the reference point set that was passed to the constructor.
A special case of DigitalNet for the base .
void setNumBits(int numBits)
Set the number of bits to randomize to numBits.
NestedUniformScrambling(RandomStream stream)
Same as NestedUniformScrambling (stream, 0).
String toString()
Returns a descriptor of this object.
RandomStream getStream()
Returns the internal umontreal.ssj.rng.RandomStream.
void setStream(RandomStream stream)
Sets the internal umontreal.ssj.rng.RandomStream to stream.
void randomize(PointSet p)
Scrambles the points of the DigitalNetBase2 contained in the CachedPointSet p and caches the scramble...
NestedUniformScrambling(RandomStream stream, int numBits)
Create a NestedUniformScrambling instance, using stream as the source of randomness,...
This abstract class represents a general point set.
Definition PointSet.java:99
This interface is for a randomization that can be used to randomize a umontreal.ssj....
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...