*/\r
public class PinkNoiseWindModel implements WindModel {\r
\r
- /** Source for seed numbers, may be overridden by get/setSeed(). */\r
- private static final Random seedSource = new Random();\r
+ /** Random value with which to XOR the random seed value */\r
+ private static final int SEED_RANDOMIZATION = 0x7343AA03;\r
\r
+\r
+\r
/** Pink noise alpha parameter. */\r
private static final double ALPHA = 5.0 / 3.0;\r
\r
private double average = 0;\r
private double standardDeviation = 0;\r
\r
- private int seed;\r
+ private final int seed;\r
\r
private PinkNoise randomSource = null;\r
private double time1;\r
\r
\r
/**\r
- * Construct a new wind simulator with a random starting seed value.\r
+ * Construct a new wind simulation with a specific seed value.\r
+ * @param seed the seed value.\r
*/\r
- public PinkNoiseWindModel() {\r
- synchronized (seedSource) {\r
- seed = seedSource.nextInt();\r
- }\r
+ public PinkNoiseWindModel(int seed) {\r
+ this.seed = seed ^ SEED_RANDOMIZATION;\r
}\r
\r
\r
\r
\r
\r
- public int getSeed() {\r
- return seed;\r
- }\r
- \r
- public void setSeed(int seed) {\r
- if (this.seed == seed)\r
- return;\r
- this.seed = seed;\r
- }\r
- \r
- \r
-\r
@Override\r
public Coordinate getWindVelocity(double time, double altitude) {\r
if (time < 0) {\r