[Mono-bugs] [Bug 43597][Wis] Changed - When Random () is started with a seed 0, it always returns 0 for NextValue

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Wed, 28 May 2003 22:51:39 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by spouliot@videotron.ca.

http://bugzilla.ximian.com/show_bug.cgi?id=43597

--- shadow/43597	Wed May 28 22:44:08 2003
+++ shadow/43597.tmp.23778	Wed May 28 22:51:39 2003
@@ -63,6 +63,23 @@
 I think we should switch to this alg so that we have no bugs in our
 implementation that MS does not have. Java does something similar,
 their RNG is standerdized.
 
 I will translate the code. It will need to be reviewed (for accuracy,
 security).
+
+------- Additional Comments From spouliot@videotron.ca  2003-05-28 22:51 -------
+int x = 4;
+byte[] buffer = new byte[8];
+while (x-- > 0) {
+	int seed = (x << x);
+	Random random = new Random (seed);
+	random.NextBytes (buffer);
+	Console.WriteLine ("Seed={0} -> {1}", seed, 
+BitConverter.ToString (buffer));
+}
+
+result using MS framework 1.0
+Seed=24 -> 43-DB-8B-AE-0A-88-A8-7B
+Seed=8 -> E7-2A-5C-44-D1-8C-7D-74
+Seed=2 -> C5-67-2A-FC-1B-4E-CD-72
+Seed=0 -> B9-D1-C4-8E-34-8F-E7-71