@@ -12,9 +12,17 @@ type Gen private () =
1212 /// Create a generator that always yields a constant value.
1313 /// </summary >
1414 /// <param name =" value " >The constant value the generator always returns.</param >
15+ [<Obsolete( " Use Gen.Constant instead." ) >]
1516 static member FromValue ( value : 'T ) : Gen < 'T > =
1617 Gen.constant value
1718
19+ /// <summary >
20+ /// Create a generator that always yields a constant value.
21+ /// </summary >
22+ /// <param name =" value " >The constant value the generator always returns.</param >
23+ static member Constant ( value : 'T ) : Gen < 'T > =
24+
25+ Gen.constant value
1826 static member FromRandom ( random : Random < Tree < 'T >>) : Gen < 'T > =
1927 Gen.ofRandom random
2028
@@ -73,18 +81,27 @@ type Gen private () =
7381 /// <i >The input list must be non-empty.</i >
7482 /// </summary >
7583 /// <param name =" items " >A non-empty IEnumerable of the Gen's possible values</param >
76- static member Item ( items : seq < 'T >) : Gen < 'T > =
84+ static member Item ( [<ParamArray>] items : array < 'T >) : Gen < 'T > =
7785 Gen.item items
7886
7987 /// Uses a weighted distribution to randomly select one of the gens in the list.
8088 /// This generator shrinks towards the first generator in the list.
8189 /// <i >The input list must be non-empty.</i >
82- static member Frequency ( gens : seq < int * Gen < 'T >>) : Gen < 'T > =
90+ static member Frequency ( [<ParamArray>] gens : array < int * Gen < 'T >>) : Gen < 'T > =
8391 Gen.frequency gens
8492
93+ /// Uses a weighted distribution to randomly select one of the gens in the list.
94+ /// This generator shrinks towards the first generator in the list.
95+ /// <i >The input list must be non-empty.</i >
96+ static member Frequency ( [<ParamArray>] values : array < struct ( int * 'T )>) : Gen < 'T > =
97+ values
98+ |> Seq.map ( fun struct ( weight , value ) -> ( weight, Gen.constant value))
99+ |> Gen.frequency
100+
101+
85102 /// Randomly selects one of the gens in the list.
86103 /// <i >The input list must be non-empty.</i >
87- static member Choice ( gens : seq < Gen < 'T >>) : Gen < 'T > =
104+ static member Choice ( [<ParamArray>] gens : array < Gen < 'T >>) : Gen < 'T > =
88105 Gen.choice gens
89106
90107 /// Randomly selects from one of the gens in either the non-recursive or the
@@ -157,6 +174,7 @@ type Gen private () =
157174
158175 /// <summary >
159176 /// Generates a random Latin-1 character, i.e. from '\000' to '\255', i.e. any 8 bit character.
177+ /// </summary >
160178 /// <remarks >
161179 /// Non-printable and control characters can be generated, e.g. NULL and BEL.
162180 /// </remarks >
@@ -278,7 +296,6 @@ type Gen private () =
278296 static member DateTimeOffset ( range : Range < DateTimeOffset >) : Gen < DateTimeOffset > =
279297 Gen.dateTimeOffset range
280298
281- [<Extension>]
282299[<AbstractClass; Sealed>]
283300type GenExtensions private () =
284301
@@ -289,6 +306,7 @@ type GenExtensions private () =
289306 /// <summary >
290307 /// Generates an array using a 'Range' to determine the length.
291308 /// </summary >
309+ /// <param name =" gen " >Item generator.</param >
292310 /// <param name =" range " >Range determining the length of the array.</param >
293311 [<Extension>]
294312 static member Array ( gen : Gen < 'T >, range : Range < int >) : Gen < 'T []> =
@@ -297,6 +315,7 @@ type GenExtensions private () =
297315 /// <summary >
298316 /// Generates an enumerable using a 'Range' to determine the length.
299317 /// </summary >
318+ /// <param name =" gen " >Item generator.</param >
300319 /// <param name =" range " >Range determining the length of the enumerable.</param >
301320 [<Extension>]
302321 static member Enumerable ( gen : Gen < 'T >, range : Range < int >) : Gen < seq < 'T >> =
@@ -347,6 +366,7 @@ type GenExtensions private () =
347366 Gen.resize size gen
348367
349368 /// <summary >Returns a List of values produced by the generator.</summary >
369+ /// <param name =" gen " >Value generator.</param >
350370 /// <param name =" size " >The size parameter for the generator.</param >
351371 /// <param name =" count " >The number of samples to produce, i.e. the length of the List.</param >
352372 [<Extension>]
@@ -386,11 +406,11 @@ type GenExtensions private () =
386406 Gen.mapTree binder.Invoke gen
387407
388408 /// <summary >
389- /// Projects each value of a generator into a new form. Similar to <c >Enumerable.Select<c >.
409+ /// Projects each value of a generator into a new form. Similar to <c >Enumerable.Select</ c >.
390410 /// </summary >
391411 /// <example >
392412 /// <code >
393- /// Gen< Point > pointGen = Gen.Int32(Range.Constant(0,200))
413+ /// Gen& lt ; Point& gt ; pointGen = Gen.Int32(Range.Constant(0,200))
394414 /// .Tuple2()
395415 /// .Select(tuple => new Point(tuple.Item1, tuple.Item2));
396416 /// </code >
@@ -400,11 +420,11 @@ type GenExtensions private () =
400420 Gen.map mapper.Invoke gen
401421
402422 /// <summary >
403- /// Projects each value of a generator into a new form. Similar to <c >Enumerable.Select<c >.
423+ /// Projects each value of a generator into a new form. Similar to <c >Enumerable.Select</ c >.
404424 /// </summary >
405425 /// <example >
406426 /// <code >
407- /// Gen< Point > pointGen = Gen.Int32(Range.Constant(0,200))
427+ /// Gen& lt ; Point& gt ; pointGen = Gen.Int32(Range.Constant(0,200))
408428 /// .Tuple2()
409429 /// .Select(tuple => new Point(tuple.Item1, tuple.Item2));
410430 /// </code >
@@ -416,11 +436,11 @@ type GenExtensions private () =
416436 genB
417437
418438 /// <summary >
419- /// Projects each value of a generator into a new form. Similar to <c >Enumerable.Select<c >.
439+ /// Projects each value of a generator into a new form. Similar to <c >Enumerable.Select</ c >.
420440 /// </summary >
421441 /// <example >
422442 /// <code >
423- /// Gen< Point > pointGen = Gen.Int32(Range.Constant(0,200))
443+ /// Gen& lt ; Point& gt ; pointGen = Gen.Int32(Range.Constant(0,200))
424444 /// .Tuple2()
425445 /// .Select(tuple => new Point(tuple.Item1, tuple.Item2));
426446 /// </code >
@@ -433,11 +453,11 @@ type GenExtensions private () =
433453 genC
434454
435455 /// <summary >
436- /// Projects each value of a generator into a new form. Similar to <c >Enumerable.Select<c >.
456+ /// Projects each value of a generator into a new form. Similar to <c >Enumerable.Select</ c >.
437457 /// </summary >
438458 /// <example >
439459 /// <code >
440- /// Gen< Point > pointGen = Gen.Int32(Range.Constant(0,200))
460+ /// Gen& lt ; Point& gt ; pointGen = Gen.Int32(Range.Constant(0,200))
441461 /// .Tuple2()
442462 /// .Select(tuple => new Point(tuple.Item1, tuple.Item2));
443463 /// </code >
0 commit comments