[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: pcb.git: branch: master updated (64bbe4248f8b194a6a8d620c477744f702d1781b)



The branch, master has been updated
       via  64bbe4248f8b194a6a8d620c477744f702d1781b (commit)
      from  f7b6acf1e1761df4302dc4599608017248530aec (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 configure.ac      |    2 +-
 src/action.c      |    5 +++--
 src/hid/png/png.c |    6 +++---
 src/main.c        |    3 +++
 4 files changed, 10 insertions(+), 6 deletions(-)


=================
 Commit Messages
=================

commit 64bbe4248f8b194a6a8d620c477744f702d1781b
Author: Bob Paddock <bobpspam@xxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Use rand() in place of random().
    
    The 'random', 'srandom', functions are those from BSD derived UNIX's,
    and may not be available under WIN32.  The 'rand' and 'srand'
    functions are required by the ANSI standard.
    
    rand(): Return a random integer between 0 and RAND_MAX inclusive.
    random(): Return a random long integer between 0 and RAND_MAX inclusive.
    
    Standard MinGW stdlib.h only supports rand() and RAND_MAX is limited
    to the 32 bit value of 32767, which is significantly smaller than that
    returned by random().  This turncation of range should not effect
    usage in our application.
    
    Added srand( time(NULL) ) to main.c to set the seed.

:100644 100644 8fde977... b139388... M	configure.ac
:100644 100644 de2738e... 63ef37e... M	src/action.c
:100644 100644 06e22bb... 022da9c... M	src/hid/png/png.c
:100644 100644 3fff933... a344596... M	src/main.c

=========
 Changes
=========

commit 64bbe4248f8b194a6a8d620c477744f702d1781b
Author: Bob Paddock <bobpspam@xxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Use rand() in place of random().
    
    The 'random', 'srandom', functions are those from BSD derived UNIX's,
    and may not be available under WIN32.  The 'rand' and 'srand'
    functions are required by the ANSI standard.
    
    rand(): Return a random integer between 0 and RAND_MAX inclusive.
    random(): Return a random long integer between 0 and RAND_MAX inclusive.
    
    Standard MinGW stdlib.h only supports rand() and RAND_MAX is limited
    to the 32 bit value of 32767, which is significantly smaller than that
    returned by random().  This turncation of range should not effect
    usage in our application.
    
    Added srand( time(NULL) ) to main.c to set the seed.

diff --git a/configure.ac b/configure.ac
index 8fde977..b139388 100644
--- a/configure.ac
+++ b/configure.ac
@@ -651,7 +651,7 @@ AC_CHECK_FUNCS(regcomp re_comp)
 AC_CHECK_FUNCS(logf expf rint)
 AC_CHECK_FUNCS(vsnprintf)
 AC_CHECK_FUNCS(getpwuid getcwd)
-AC_CHECK_FUNCS(random)
+AC_CHECK_FUNCS(rand random)
 AC_CHECK_FUNCS(stat)
 
 AC_CHECK_FUNCS(mkdtemp)
diff --git a/src/action.c b/src/action.c
index de2738e..63ef37e 100644
--- a/src/action.c
+++ b/src/action.c
@@ -72,6 +72,7 @@
 #include "macro.h"
 
 #include <assert.h>
+#include <stdlib.h> /* rand() */
 
 #ifdef HAVE_LIBDMALLOC
 #include <dmalloc.h>
@@ -7158,8 +7159,8 @@ ActionElementList (int argc, char **argv, int x, int y)
 
       if (d > 0)
 	{
-	  nx += random () % (d*2) - d;
-	  ny += random () % (d*2) - d;
+	  nx += rand () % (d*2) - d;
+	  ny += rand () % (d*2) - d;
 	}
 
       if (nx < 0)
diff --git a/src/hid/png/png.c b/src/hid/png/png.c
index 06e22bb..022da9c 100644
--- a/src/hid/png/png.c
+++ b/src/hid/png/png.c
@@ -768,12 +768,12 @@ png_do_export (HID_Attr_Val * options)
 		  else
 		    {
 		      rgb (&cop, 140, 150, 160);
-#if 1
-		      r = (random() % 5 - 2) * 2;
+
+		      r = (rand() % 5 - 2) * 2;
 		      cop.r += r;
 		      cop.g += r;
 		      cop.b += r;
-#endif
+
 		    }
 		  
 		  if (cc == TOP_SHADOW)
diff --git a/src/main.c b/src/main.c
index 3fff933..a344596 100644
--- a/src/main.c
+++ b/src/main.c
@@ -40,6 +40,7 @@
 #include <signal.h>
 #include <unistd.h>
 #include <sys/stat.h>
+#include <time.h> /* Seed for srand() */
 
 #include "global.h"
 #include "data.h"
@@ -906,6 +907,8 @@ main (int argc, char *argv[])
   bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
   bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
 
+  srand ( time(NULL) ); /* Set seed for rand() */
+
   hid_init ();
 
   hid_load_settings ();




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs