[MLton] cvs commit: fixed bug in MLton.Random.alphaNumString

Stephen Weeks sweeks@mlton.org
Sun, 28 Dec 2003 14:43:49 -0800


sweeks      03/12/28 14:43:48

  Modified:    basis-library/mlton random.sml
               doc      changelog
  Log:
  MAIL fixed bug in MLton.Random.alphaNumString
  
  Fixed bug in MLton.Random.alphaNumString that Jesper saw that caused
  it to return #"0" for all characters beyond position 11.  The bug was
  that Int.quot was mistakenly used instead of Int.rem to periodically
  refresh the random number.

Revision  Changes    Path
1.7       +1 -1      mlton/basis-library/mlton/random.sml

Index: random.sml
===================================================================
RCS file: /cvsroot/mlton/mlton/basis-library/mlton/random.sml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- random.sml	25 Sep 2003 01:43:26 -0000	1.6
+++ random.sml	28 Dec 2003 22:43:48 -0000	1.7
@@ -69,7 +69,7 @@
 	    (length, fn i =>
 	     let
 		val _ =
-		   if 0 = Int.quot (i, 6) (* n^6 = 62^6 = 965,660,736 *)
+		   if 0 = Int.rem (i, 6) (* n^6 = 62^6 = 965,660,736 *)
 		      then r := rand ()
 		   else ()
 		val w = !r



1.95      +4 -0      mlton/doc/changelog

Index: changelog
===================================================================
RCS file: /cvsroot/mlton/mlton/doc/changelog,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- changelog	18 Dec 2003 03:14:24 -0000	1.94
+++ changelog	28 Dec 2003 22:43:48 -0000	1.95
@@ -1,5 +1,9 @@
 Here are the changes since version 20030716.
 
+* 2003-12-28
+  - Fixed horrible bug in MLton.Random.alphaNumString that caused it
+    to return 0 for all characters beyond position 11.
+
 * 2003-12-17
   - Removed -basis as a normal flag.  It is still available as an
     expert flag, but its use is deprecated.  It will almost certainly