]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
script: seed random number generator
authorRay Strode <rstrode@redhat.com>
Fri, 8 Jun 2012 20:52:29 +0000 (16:52 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 8 Jun 2012 20:52:29 +0000 (16:52 -0400)
Most splash plugins that use random numbers
seed the random number generator with the
current time, but script fails, too.

This commit fixes that.

https://bugs.freedesktop.org/show_bug.cgi?id=42632

src/plugins/splash/script/script-lib-math.c

index 383fe46f6606c0b65cc108282e5eded02def9868..a1afc041b5eb0a8b4a0b17e38ad49953c03d5bb0 100644 (file)
@@ -65,6 +65,8 @@ script_lib_math_data_t *script_lib_math_setup (script_state_t *state)
 {
   script_lib_math_data_t *data = malloc (sizeof (script_lib_math_data_t));
 
+  srand ((int) ply_get_timestamp ());
+
   script_obj_t *math_hash = script_obj_hash_get_element (state->global, "Math");
   script_add_native_function (math_hash,
                               "Cos",