Lucene.Net.TestFramework.Randomized.Generators.RandomInts: Fixed bug in RandomFrom so the entire range is used (the upper bound of Random(int, int) is exclusive, so we don't need to subtract 1 from Count).
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/9b9cd819 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/9b9cd819 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/9b9cd819 Branch: refs/heads/api-work Commit: 9b9cd8196525f1fae5f8ee6d4c55485e4bfd89aa Parents: bfc94fb Author: Shad Storhaug <[email protected]> Authored: Tue Feb 28 17:14:07 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Tue Feb 28 17:14:07 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9b9cd819/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs b/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs index edc36d3..f3704a9 100644 --- a/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs +++ b/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs @@ -39,12 +39,12 @@ namespace Lucene.Net.Randomized.Generators public static T RandomFrom<T>(Random rand, ISet<T> set) { - return set.ElementAt(rand.Next(0, set.Count - 1)); + return set.ElementAt(rand.Next(0, set.Count)); } public static T RandomFrom<T>(Random rand, IList<T> set) { - return set.ElementAt(rand.Next(0, set.Count - 1)); + return set.ElementAt(rand.Next(0, set.Count)); } } } \ No newline at end of file
