A workaround is to generate a value for seed using a similar procedure to Random's, record it, and then pass it to a seed setter:
void setup() {
size(WIDTH, HEIGHT);
long seed = 8682522807148013L + System.nanoTime();
System.out.println(seed);
randomSeed(seed);
doDrawing();
}
output: 8702777365341749
If this run turns out to be the great one change setup() to
void setup() {
size(WIDTH, HEIGHT);
// long seed = 8682522807148013L + System.nanoTime();
// System.out.println(seed);
randomSeed(8702777365341749L);
doDrawing();
}
identical graphic output is recreated. Otherwise, just continue with the original setup() version and hope for the best. The same seed generation method is appropriate for noiseSeed(). The seed calculation shown will avoid holes in the total sequence of values returned by nextLong() - if such exist and affect the 48 bit seed used by Random that is.
No comments:
Post a Comment