MCPcopy Create free account
hub / github.com/apache/arrow-rs / create_boolean_array

Function create_boolean_array

arrow/src/util/bench_util.rs:128–143  ·  view source on GitHub ↗

Creates a random (but fixed-seeded) array of a given size and null density

(size: usize, null_density: f32, true_density: f32)

Source from the content-addressed store, hash-verified

126
127/// Creates a random (but fixed-seeded) array of a given size and null density
128pub fn create_boolean_array(size: usize, null_density: f32, true_density: f32) -> BooleanArray
129where
130 StandardUniform: Distribution<bool>,
131{
132 let mut rng = seedable_rng();
133 (0..size)
134 .map(|_| {
135 if rng.random::<f32>() < null_density {
136 None
137 } else {
138 let value = rng.random::<f32>() < true_density;
139 Some(value)
140 }
141 })
142 .collect()
143}
144
145/// Creates a random array of a given size and null density based on the provided seed
146pub fn create_boolean_array_with_seed(

Callers 11

buildMethod · 0.85
add_benchmarkFunction · 0.85
add_benchmarkFunction · 0.85
add_benchmarkFunction · 0.85
add_benchmarkFunction · 0.85
create_bool_arrayFunction · 0.85
add_benchmarkFunction · 0.85
add_benchmarkFunction · 0.85
add_benchmarkFunction · 0.85
add_benchmarkFunction · 0.85
create_random_arrayFunction · 0.85

Calls 2

collectMethod · 0.80
seedable_rngFunction · 0.70

Tested by

no test coverage detected