alamb commented on code in PR #7045:
URL: https://github.com/apache/arrow-rs/pull/7045#discussion_r1933804289
##########
arrow-array/benches/union_array.rs:
##########
@@ -24,27 +24,27 @@ use arrow_array::{Array, ArrayRef, Int32Array, UnionArray};
use arrow_buffer::{NullBuffer, ScalarBuffer};
use arrow_schema::{DataType, Field, UnionFields};
use criterion::*;
-use rand::{thread_rng, Rng};
+use rand::{rng, Rng};
fn array_with_nulls() -> ArrayRef {
- let mut rng = thread_rng();
+ let mut rng = rng();
- let values = ScalarBuffer::from_iter(repeat_with(|| rng.gen()).take(4096));
+ let values = ScalarBuffer::from_iter(repeat_with(||
rng.random()).take(4096));
// nulls with at least one null and one valid
let nulls: NullBuffer = [true, false]
.into_iter()
- .chain(repeat_with(|| rng.gen()))
+ .chain(repeat_with(|| rng.random()))
.take(4096)
.collect();
Arc::new(Int32Array::new(values.clone(), Some(nulls)))
}
fn array_without_nulls() -> ArrayRef {
- let mut rng = thread_rng();
+ let mut rng = rng();
- let values = ScalarBuffer::from_iter(repeat_with(|| rng.gen()).take(4096));
+ let values = ScalarBuffer::from_iter(repeat_with(||
rng.random()).take(4096));
Review Comment:
I like this rename from `gen` to `random` -- I think it is much clearer now
##########
arrow-buffer/src/util/bit_chunk_iterator.rs:
##########
@@ -624,21 +627,25 @@ mod tests {
#[test]
#[cfg_attr(miri, ignore)]
fn fuzz_unaligned_bit_chunk_iterator() {
- let mut rng = thread_rng();
+ let mut rng = rng();
+ let usize = UniformUsize::new(usize::MIN, usize::MAX).unwrap();
Review Comment:
I found this name confusing -- using `usize` as a variable name was
unexpected. Can we call it `uusize` or something to make it clear it is
different than the type `usize`?
There are a few other similar refactors below
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]