bempp_octree::tools

Function generate_random_keys

Source
pub fn generate_random_keys<R: Rng>(nkeys: usize, rng: &mut R) -> Vec<MortonKey>
Expand description

Generate random keys for testing.

Examples found in repository?
examples/parsort.rs (line 16)
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
pub fn main() {
    let universe = mpi::initialize().unwrap();
    let world = universe.world();
    let n_per_rank = 1000;

    let mut rng = rand::rngs::StdRng::seed_from_u64(0);

    let keys = generate_random_keys(n_per_rank, &mut rng);

    let arr = parsort(&keys, &world, &mut rng);

    assert!(is_sorted_array(&arr, &world));

    if world.rank() == 0 {
        println!("Array is sorted.");
    }
}