pub fn counter(range: Range<u128>) -> impl FnMut(&State) -> u128
Expand description

A pre-canned delegate that counts in the given range, wrapping around when it reaches the end.

Examples

use tinyrand::Rand;
use tinyrand_alloc::{Mock, counter};

let mut mock = Mock::default().with_next_u128(counter(5..8));
assert_eq!(5, mock.next_u64());
assert_eq!(6, mock.next_u64());
assert_eq!(7, mock.next_u64());
assert_eq!(5, mock.next_u64());