SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
RandomStart.java
1/*
2 * Class: RandomStart
3 * Description: Randomizes a sequence with a random starting point
4 * Environment: Java
5 * Software: SSJ
6 * Copyright (C) 2001 Pierre L'Ecuyer and Universite de Montreal
7 * Organization: DIRO, Universite de Montreal
8 * @author
9 * @since
10 *
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 */
25package umontreal.ssj.hups;
26
27import umontreal.ssj.rng.RandomStream;
28import java.lang.IllegalArgumentException;
29
39public class RandomStart implements PointSetRandomization {
40
41 protected RandomStream stream;
42
46 public RandomStart() {
47 }
48
54 public RandomStart(RandomStream stream) {
55 this.stream = stream;
56 }
57
65 public void randomize(PointSet p) {
66 if (p instanceof HaltonSequence) {
67 double[] x0 = new double[p.getDimension()];
68 stream.nextArrayOfDouble(x0, 0, x0.length);
69 ((HaltonSequence) p).setStart(x0);
70 } else {
71 throw new IllegalArgumentException("RandomStart" + " can only randomize a HaltonSequence");
72 }
73 }
74
80 public void setStream(RandomStream stream) {
81 this.stream = stream;
82 }
83
90 return stream;
91 }
92
93}
This class implements the sequence of Halton rhal60a , which is essentially a modification of Hammers...
This abstract class represents a general point set.
Definition PointSet.java:99
int getDimension()
Returns the dimension (number of available coordinates) of the points.
RandomStream getStream()
Returns the internal umontreal.ssj.rng.RandomStream.
void randomize(PointSet p)
This method calls umontreal.ssj.hups.HaltonSequence.init(double[]).
RandomStart(RandomStream stream)
Sets internal variable stream to the given stream.
void setStream(RandomStream stream)
Sets the internal umontreal.ssj.rng.RandomStream to stream.
RandomStart()
Empty constructor.
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...