Macro malachite_base::random_tuples
source · [−]macro_rules! random_tuples {
(
($($vis:tt)*),
$random_struct: ident,
$random_struct_from_single: ident,
$random_fn: ident,
$random_fn_from_single: ident,
$single_out: tt,
$([$i: expr, $t: ident, $it: ident, $xs: ident, $xs_gen:ident]),*
) => { ... };
}
Expand description
Defines random tuple generators.
Malachite provides random_pairs
and random_pairs_from_single
, but you can also define
random_triples
, random_quadruples
, and so on, and random_triples_from_single
,
random_quadruples_from_single
, and so on, in your program using the code below. The
documentation for random_pairs
and random_pairs_from_single
describes these other
functions as well.
See usage examples here and here.
use malachite_base::num::random::{random_unsigned_range, RandomUnsignedRange};
use malachite_base::random::Seed;
use malachite_base::tuples::random::next_helper;
random_tuples!(
(pub(crate)),
RandomTriples,
RandomTriplesFromSingle,
random_triples,
random_triples_from_single,
(I::Item, I::Item, I::Item),
[0, X, I, xs, xs_gen],
[1, Y, J, ys, ys_gen],
[2, Z, K, zs, zs_gen]
);
random_tuples!(
(pub(crate)),
RandomQuadruples,
RandomQuadruplesFromSingle,
random_quadruples,
random_quadruples_from_single,
(I::Item, I::Item, I::Item, I::Item),
[0, X, I, xs, xs_gen],
[1, Y, J, ys, ys_gen],
[2, Z, K, zs, zs_gen],
[3, W, L, ws, ws_gen]
);
random_tuples!(
(pub(crate)),
RandomQuintuples,
RandomQuintuplesFromSingle,
random_quintuples,
random_quintuples_from_single,
(I::Item, I::Item, I::Item, I::Item, I::Item),
[0, X, I, xs, xs_gen],
[1, Y, J, ys, ys_gen],
[2, Z, K, zs, zs_gen],
[3, W, L, ws, ws_gen],
[4, V, M, vs, vs_gen]
);
random_tuples!(
(pub(crate)),
RandomSextuples,
RandomSextuplesFromSingle,
random_sextuples,
random_sextuples_from_single,
(I::Item, I::Item, I::Item, I::Item, I::Item, I::Item),
[0, X, I, xs, xs_gen],
[1, Y, J, ys, ys_gen],
[2, Z, K, zs, zs_gen],
[3, W, L, ws, ws_gen],
[4, V, M, vs, vs_gen],
[5, U, N, us, us_gen]
);
random_tuples!(
(pub(crate)),
RandomSeptuples,
RandomSeptuplesFromSingle,
random_septuples,
random_septuples_from_single,
(
I::Item,
I::Item,
I::Item,
I::Item,
I::Item,
I::Item,
I::Item
),
[0, X, I, xs, xs_gen],
[1, Y, J, ys, ys_gen],
[2, Z, K, zs, zs_gen],
[3, W, L, ws, ws_gen],
[4, V, M, vs, vs_gen],
[5, U, N, us, us_gen],
[6, T, O, ts, ts_gen]
);
random_tuples!(
(pub(crate)),
RandomOctuples,
RandomOctuplesFromSingle,
random_octuples,
random_octuples_from_single,
(
I::Item,
I::Item,
I::Item,
I::Item,
I::Item,
I::Item,
I::Item,
I::Item
),
[0, X, I, xs, xs_gen],
[1, Y, J, ys, ys_gen],
[2, Z, K, zs, zs_gen],
[3, W, L, ws, ws_gen],
[4, V, M, vs, vs_gen],
[5, U, N, us, us_gen],
[6, T, O, ts, ts_gen],
[7, S, P, ss, ss_gen]
);