diff --git a/simgear/math/sg_random.c b/simgear/math/sg_random.c index adac20cb..c602bb53 100644 --- a/simgear/math/sg_random.c +++ b/simgear/math/sg_random.c @@ -134,6 +134,13 @@ void sg_srandom_time() { init_genrand(time(NULL)); } +// Seed the random number generater with time() in 10 minute intervals +// so we get the same sequence within 10 minutes interval. +// This is useful for synchronizing two display systems. +void sg_srandom_time_10() { + init_genrand(time(NULL) / 600); +} + // Seed the random number generater with your own seed so can set up // repeatable randomization. diff --git a/simgear/math/sg_random.h b/simgear/math/sg_random.h index aaea0c45..6d993296 100644 --- a/simgear/math/sg_random.h +++ b/simgear/math/sg_random.h @@ -40,6 +40,13 @@ extern "C" { */ void sg_srandom_time(); +/** + * Seed the random number generater with time() in 10 minute intervals + * so we get the same sequence within 10 minutes interval. + * This is useful for synchronizing two display systems. + */ +void sg_srandom_time_10(); + /** * Seed the random number generater with your own seed so can set up * repeatable randomization.