Skip to main content

new_random_string_set

Function new_random_string_set 

Source
pub fn new_random_string_set<const N: usize>(
    item_count: usize,
) -> RUMVec<RUMString>
Expand description

Generates a new random set of RUMString using the rand crate.

The buffer size for each item can be adjusted via the turbofish method => new_random_string_set::<10>().

ยงExample

use rumtk_core::core::{new_random_string_set, DEFAULT_BUFFER_CHUNK_SIZE};
const item_count: usize = 5;

let buffer = new_random_string_set::<DEFAULT_BUFFER_CHUNK_SIZE>(item_count);

assert_eq!(buffer.is_empty(), false, "Function returned an empty random buffer which was unexpected!");
assert_eq!(buffer.len(), item_count, "The new random buffer does not have the expected item count!");
assert_eq!(buffer.get(0).unwrap().len(), DEFAULT_BUFFER_CHUNK_SIZE, "The new random buffer does not have the expected size!");