public static <R extends RandomGenerator> void using(
		final RandomGeneratorFactory<? extends R> factory,
		final Consumer<? super R> consumer
	) {
		CONTEXT.with(
			new TLR<>(factory::create),
			r -> { consumer.accept(r.get()); return null; }
		);
	}
Executes the consumer code using the given {@code random} generator.
{@snippet lang="java":
final MSeq<Integer> seq = null; // @replace substring='null' replacement="..."
using(RandomGeneratorFactory.getDefault(), r -> {
    seq.shuffle();
});
}

The example above shuffles the given integer {@code seq} <i>using</i> the
given {@link RandomGeneratorFactory#getDefault()} factory.

@since 7.0

@param factory the random generator factory used within the consumer
@param consumer the consumer which is executed within the <i>scope</i> of
       the given random generator.
@param <R> the type of the random engine
@throws NullPointerException if one of the arguments is {@code null}
jenetics/src/main/java/io/jenetics/util/RandomRegistry.java