Fix the range for rnd.Next()
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 11 Aug 2011 18:16:24 +0000 (14:16 -0400)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 11 Aug 2011 18:16:24 +0000 (14:16 -0400)
mcs/class/System/System.Net/WebConnectionGroup.cs

index 8f0c5aa19499aadb47b382771922ee0012e76940..ea298ebe7b7ed7667b2757707c895cd724eac187 100644 (file)
@@ -160,7 +160,7 @@ namespace System.Net
                        if (rnd == null)
                                rnd = new Random ();
 
-                       int idx = (count > 1) ? rnd.Next (0, count - 1) : 0;
+                       int idx = (count > 1) ? rnd.Next (0, count) : 0;
                        cncRef = (WeakReference) connections [idx];
                        cnc = cncRef.Target as WebConnection;
                        if (cnc == null) {