Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump rand to 0.9.0 #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ndarray = "0.16.0"
noisy_float = "0.2.0"
num-integer = "0.1"
num-traits = "0.2"
rand = "0.8.3"
rand = "0.9.0"
itertools = { version = "0.13", default-features = false }
indexmap = "2.4"

Expand Down
11 changes: 5 additions & 6 deletions src/sort.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use indexmap::IndexMap;
use ndarray::prelude::*;
use ndarray::{Data, DataMut, Slice};
use rand::prelude::*;
use rand::thread_rng;
use rand::{prelude::*, rng};

/// Methods for sorting and partitioning 1-D arrays.
pub trait Sort1dExt<A, S>
Expand Down Expand Up @@ -115,8 +114,8 @@ where
if n == 1 {
self[0].clone()
} else {
let mut rng = thread_rng();
let pivot_index = rng.gen_range(0..n);
let mut rng = rng();
let pivot_index = rng.random_range(0..n);
let partition_index = self.partition_mut(pivot_index);
if i < partition_index {
self.slice_axis_mut(Axis(0), Slice::from(..partition_index))
Expand Down Expand Up @@ -250,8 +249,8 @@ fn _get_many_from_sorted_mut_unchecked<A>(
}

// We pick a random pivot index: the corresponding element is the pivot value
let mut rng = thread_rng();
let pivot_index = rng.gen_range(0..n);
let mut rng = rng();
let pivot_index = rng.random_range(0..n);

// We partition the array with respect to the pivot value.
// The pivot value moves to `array_partition_index`.
Expand Down