@@ -69,7 +69,7 @@ all rights reserved.
6969 (fun self n -> match n with
7070 | 0 -> map leaf nat
7171 | n ->
72- frequency
72+ oneof_weighted
7373 [1, map leaf nat;
7474 2, map2 node (self (n/2)) (self (n/2))]
7575 ))
@@ -224,17 +224,35 @@ module Gen : sig
224224 @raise Invalid_argument or Failure if list is empty
225225 @deprecated use {!oneof_array} instead. *)
226226
227+ val oneof_weighted : (int * 'a t ) list -> 'a t
228+ (* * Constructs a generator that selects among a given list of generators.
229+ Each of the given generators are chosen based on a positive integer weight.
230+ @since NEXT_RELEASE *)
231+
227232 val frequency : (int * 'a t ) list -> 'a t
228233 (* * Constructs a generator that selects among a given list of generators.
229- Each of the given generators are chosen based on a positive integer weight. *)
234+ Each of the given generators are chosen based on a positive integer weight.
235+ @deprecated use {!oneof_weighted} instead. *)
236+
237+ val oneof_weighted_list : (int * 'a ) list -> 'a t
238+ (* * Constructs a generator that selects among a given list of values.
239+ Each of the given values are chosen based on a positive integer weight.
240+ @since NEXT_RELEASE *)
230241
231242 val frequencyl : (int * 'a ) list -> 'a t
232243 (* * Constructs a generator that selects among a given list of values.
233- Each of the given values are chosen based on a positive integer weight. *)
244+ Each of the given values are chosen based on a positive integer weight.
245+ @deprecated use {!oneof_weighted_list} instead. *)
246+
247+ val oneof_weighted_array : (int * 'a ) array -> 'a t
248+ (* * Constructs a generator that selects among a given array of values.
249+ Each of the array entries are chosen based on a positive integer weight.
250+ @since NEXT_RELEASE *)
234251
235252 val frequencya : (int * 'a ) array -> 'a t
236253 (* * Constructs a generator that selects among a given array of values.
237- Each of the array entries are chosen based on a positive integer weight. *)
254+ Each of the array entries are chosen based on a positive integer weight.
255+ @deprecated use {!oneof_weighted_array} instead. *)
238256
239257 val shuffle_array : 'a array -> 'a array t
240258 (* * Creates a generator of shuffled arrays.
@@ -735,7 +753,7 @@ module Gen : sig
735753 (fun self n -> match n with
736754 | 0 -> map leaf nat
737755 | n ->
738- frequency
756+ oneof_weighted
739757 [1, map leaf nat;
740758 2, map2 node (self (n/2)) (self (n/2))]
741759 ))
@@ -1782,19 +1800,38 @@ val oneof : 'a arbitrary list -> 'a arbitrary
17821800val always : ?print : 'a Print .t -> 'a -> 'a arbitrary
17831801(* * Always return the same element. *)
17841802
1803+ val oneof_weighted : ?print : 'a Print .t -> ?small : ('a -> int ) ->
1804+ ?shrink : 'a Shrink .t -> (int * 'a arbitrary ) list -> 'a arbitrary
1805+ (* * Similar to {!oneof} but with frequencies.
1806+ @since NEXT_RELEASE *)
1807+
17851808val frequency : ?print : 'a Print .t -> ?small : ('a -> int ) ->
17861809 ?shrink : 'a Shrink .t -> ?collect : ('a -> string ) ->
17871810 (int * 'a arbitrary ) list -> 'a arbitrary
1788- (* * Similar to {!oneof} but with frequencies. *)
1811+ (* * Similar to {!oneof} but with frequencies.
1812+ @deprecated use {!oneof_weighted} instead. *)
1813+
1814+ val oneof_weighted_list : ?print : 'a Print .t -> ?small : ('a -> int ) ->
1815+ (int * 'a ) list -> 'a arbitrary
1816+ (* * Same as {!oneof_list}, but each element is paired with its frequency in
1817+ the probability distribution (the higher, the more likely).
1818+ @since NEXT_RELEASE *)
17891819
17901820val frequencyl : ?print : 'a Print .t -> ?small : ('a -> int ) ->
17911821 (int * 'a ) list -> 'a arbitrary
17921822(* * Same as {!oneof_list}, but each element is paired with its frequency in
1793- the probability distribution (the higher, the more likely). *)
1823+ the probability distribution (the higher, the more likely).
1824+ @deprecated use {!oneof_weighted_list} instead. *)
1825+
1826+ val oneof_weighted_array : ?print : 'a Print .t -> ?small : ('a -> int ) ->
1827+ (int * 'a ) array -> 'a arbitrary
1828+ (* * Same as {!oneof_frequency_list}, but with an array.
1829+ @since NEXT_RELEASE *)
17941830
17951831val frequencya : ?print : 'a Print .t -> ?small : ('a -> int ) ->
17961832 (int * 'a ) array -> 'a arbitrary
1797- (* * Same as {!frequencyl}, but with an array. *)
1833+ (* * Same as {!oneof_frequency_list}, but with an array.
1834+ @deprecated use {!oneof_weighted_array} instead. *)
17981835
17991836val map : ?rev : ('b -> 'a ) -> ('a -> 'b ) -> 'a arbitrary -> 'b arbitrary
18001837(* * [map f a] returns a new arbitrary instance that generates values using
0 commit comments