[Mono-bugs] [Bug 68452][Nor] Changed - BigInteger.Randomize doesn't work if BigInteger.BitCount == 0

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 19 Oct 2004 12:00:51 -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 sebastien@ximian.com.

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

--- shadow/68452	2004-10-18 19:25:12.000000000 -0400
+++ shadow/68452.tmp.16809	2004-10-19 12:00:51.000000000 -0400
@@ -1,13 +1,13 @@
 Bug#: 68452
 Product: Mono: Class Libraries
 Version: unspecified
 OS: All
 OS Details: 
-Status: NEW   
-Resolution: 
+Status: RESOLVED   
+Resolution: FIXED
 Severity: Unknown
 Priority: Normal
 Component: CORLIB
 AssignedTo: sebastien@ximian.com                            
 ReportedBy: pieter@mentalis.org               
 QAContact: mono-bugs@ximian.com
@@ -26,6 +26,21 @@
 Also, should the BitCount method ever return zero? Does a 0-bit integer 
 make sense? If the value of the integer in question is zero, I would let 
 the BitCount method return '1'.
 
 ------- Additional Comments From vargaz@gmail.com  2004-10-17 19:00 -------
 -> class libs
+
+------- Additional Comments From sebastien@ximian.com  2004-10-19 12:00 -------
+BitCount returns the highest-bit set, so in case of BigInteger(0) 0 is
+returned. I don't wish to change this as some people may depend on
+this behaviour.
+
+Randomize design is to return a random number of BitCount size. So the
+method was fixed to always return (a random ;-) 0 if the current
+BitCount is 0. 
+
+In order to get a random BigInteger of a specific size the static
+method GenerateRandom should be used.
+
+Note: Fixed in HEAD (will backport into MONO-1-0 when I get back home
+next week).