summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2012-06-08 16:52:29 -0400
committerRay Strode <rstrode@redhat.com>2012-06-08 16:52:29 -0400
commit3f8bd998dcc6d592ffd5d3aefad06f0bbf28a725 (patch)
tree78270cceebe046ab921d1e4454a8d060c0462e9a
parentbb46ffb90ade92d87d82fadcea3a0243c80dea79 (diff)
script: seed random number generator
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
-rw-r--r--src/plugins/splash/script/script-lib-math.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/splash/script/script-lib-math.c b/src/plugins/splash/script/script-lib-math.c
index 383fe46f..a1afc041 100644
--- a/src/plugins/splash/script/script-lib-math.c
+++ b/src/plugins/splash/script/script-lib-math.c
@@ -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",