/// Creates a new [`PrimitiveArray`] from random values with a pre-set seed.
Creates a new [`PrimitiveArray`] from random values with a pre-set seed.
Creates a new [ ` PrimitiveArray ` ] from random values with a pre - set seed .
pub fn create_primitive_array_with_seed<T>(
    size: usize,
    data_type: DataType,
    null_density: f32,
    seed: u64,
) -> PrimitiveArray<T>
where
    T: NativeType + NaturalDataType,
    Standard: Distribution<T>,
{
    let mut rng = StdRng::seed_from_u64(seed);
    (0..size)
        .map(|_| {
            if rng.gen::<f32>() < null_density {
                None
            } else {
                Some(rng.gen())
            }
        })
        .collect::<PrimitiveArray<T>>()
        .to(data_type)
}
pub fn create_primitive_array_with_seed < T > ( size : usize , data_type : DataType , null_density : f32 , seed : u64 , ) -> PrimitiveArray < T > where T : NativeType + NaturalDataType , Standard : Distribution < T > , { let mut rng = StdRng :: seed_from_u64 ( seed ) ; ( 0 .. size ) . map ( | _ | { if rng . gen :: < f32 > ( ) < null_density { None } else { Some ( rng . gen ( ) ) } } ) . collect :: < PrimitiveArray < T > > ( ) . to ( data_type ) }
Creates a new [`PrimitiveArray`] from random values with a pre-set seed.
Creates a new [ ` PrimitiveArray ` ] from random values with a pre - set seed .
size
usize
data_type
DataType
null_density
f32
seed
u64