[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 10 Nov 2003 23:25:53 -0000


albertel		Mon Nov 10 18:25:53 2003 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  - rand isn't a good idea (sure it's unlikely, but with multiple cgi script calls in one page, rand can return the same number time in a row in under a second.)
  
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.151 loncom/interface/loncommon.pm:1.152
--- loncom/interface/loncommon.pm:1.151	Mon Nov 10 15:30:45 2003
+++ loncom/interface/loncommon.pm	Mon Nov 10 18:25:52 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.151 2003/11/10 20:30:45 www Exp $
+# $Id: loncommon.pm,v 1.152 2003/11/10 23:25:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2745,9 +2745,10 @@
 
 ############################################################
 ############################################################
-
+my $uniq=0;
 sub get_cgi_id {
-    return (time.'_'.int(rand(1000)));
+    $uniq=($uniq++)%100000;
+    return (time.'_'.$uniq);
 }
 
 ############################################################