From 0341cc7868ceb3aa6d5a666fce178c9a26fe949c Mon Sep 17 00:00:00 2001 From: Ryan Leavengood Date: Tue, 4 Jan 2011 18:57:24 +0000 Subject: [PATCH] Use a real random number generator instead of using a time hack. Add myself to authors. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40112 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/screen_savers/butterfly/Butterfly.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/add-ons/screen_savers/butterfly/Butterfly.cpp b/src/add-ons/screen_savers/butterfly/Butterfly.cpp index 15789fce09..54a94161de 100644 --- a/src/add-ons/screen_savers/butterfly/Butterfly.cpp +++ b/src/add-ons/screen_savers/butterfly/Butterfly.cpp @@ -4,13 +4,14 @@ * * Authors: * Geoffry Song, goffrie@gmail.com + * Ryan Leavengood, leavengood@gmail.com */ #include "Butterfly.h" #include #include -#include +#include #include #include @@ -50,9 +51,10 @@ Butterfly::StartSaver(BView* view, bool preview) SetTickSize(20000); - struct timeval tv; - gettimeofday(&tv, NULL); - fBase = tv.tv_usec * 0.01f; + // Set fBase to a random radian value scaled by 1000. The scaling produces + // more interesting results. + srand48(system_time()); + fBase = drand48() * 2 * M_PI * 1000; // calculate transformation BRect bounds = view->Bounds();