]> git.mxchange.org Git - simgear.git/commitdiff
Add a seed function that gives the same random seed within a ten minute period of...
authorehofman <ehofman>
Sat, 30 Apr 2005 09:59:12 +0000 (09:59 +0000)
committerehofman <ehofman>
Sat, 30 Apr 2005 09:59:12 +0000 (09:59 +0000)
simgear/math/sg_random.c
simgear/math/sg_random.h

index adac20cb8c8874b7b040409616bcc9073b71416e..c602bb53cd84f65ed63c84efe2bd46c1286c7896 100644 (file)
@@ -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.
index aaea0c456b151aaf2c8f0c25cae785d21dc0257e..6d993296106706da6653101aa1e7357c33ad732b 100644 (file)
@@ -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.