Permalink
Browse files

Merge pull request #2 from AOA/master

Revise the upper bound of the random values.
  • Loading branch information...
2 parents e00d0bc + 2fa7092 commit 9fad85f8bad30e6e38f12d3b2b36233e0f53f576 @Aaronontheweb committed Mar 29, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 Faker/Helpers/ArrayHelpers.cs
@@ -19,15 +19,15 @@ public static T GetRandomSubSelection<T>(this IEnumerable<T> array, int start, i
var subArray = array.ToList().GetRange(start, count);
//Determine the max length of our incoming array
- var maxLength = subArray.Count - 1;
+ var maxLength = subArray.Count;
return subArray.ElementAt(R.Next(0, maxLength));
}
public static IEnumerable<T> GetRandomSelection<T>(this IEnumerable<T> array, int count = 1)
{
//Determine the max length of our incoming array
- var maxLength = array.Count() - 1;
+ var maxLength = array.Count();
//Create a new list to contain our selection...
var randomSelection = new List<T>();
@@ -44,7 +44,7 @@ public static IEnumerable<T> GetRandomSelection<T>(this IEnumerable<T> array, in
public static T GetRandom<T>(this IEnumerable<T> array)
{
//Determine the max length of our incoming array
- var maxLength = array.Count() - 1;
+ var maxLength = array.Count();
return array.ElementAt(R.Next(0, maxLength));
}

0 comments on commit 9fad85f

Please sign in to comment.