mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 14:52:41 +00:00
test_sort: use Pcg32 random number generator
This commit is contained in:
parent
ec8e610e48
commit
729d97e993
3 changed files with 14 additions and 3 deletions
10
Cargo.lock
generated
10
Cargo.lock
generated
|
@ -367,6 +367,7 @@ dependencies = [
|
|||
"pretty_assertions",
|
||||
"procfs",
|
||||
"rand",
|
||||
"rand_pcg",
|
||||
"regex",
|
||||
"rlimit",
|
||||
"selinux",
|
||||
|
@ -1664,6 +1665,15 @@ dependencies = [
|
|||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_pcg"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.5.3"
|
||||
|
|
|
@ -391,6 +391,7 @@ glob = "0.3.0"
|
|||
libc = "0.2"
|
||||
pretty_assertions = "1"
|
||||
rand = "0.8"
|
||||
rand_pcg = "0.3"
|
||||
regex = "1.6"
|
||||
sha1 = { version="0.10", features=["std"] }
|
||||
tempfile = "3"
|
||||
|
|
|
@ -1119,13 +1119,13 @@ fn test_tmp_files_deleted_on_sigint() {
|
|||
at.mkdir("tmp_dir");
|
||||
let file_name = "big_file_to_sort.txt";
|
||||
{
|
||||
use rand::Rng;
|
||||
use rand::{Rng, SeedableRng};
|
||||
use std::io::Write;
|
||||
let mut file = at.make_file(file_name);
|
||||
// approximately 20 MB
|
||||
for _ in 0..40 {
|
||||
let lines = rand::thread_rng()
|
||||
.sample_iter(rand::distributions::uniform::Uniform::new(0, 10007))
|
||||
let lines = rand_pcg::Pcg32::seed_from_u64(123)
|
||||
.sample_iter(rand::distributions::uniform::Uniform::new(0, 10000))
|
||||
.take(100000)
|
||||
.map(|x| x.to_string() + "\n")
|
||||
.collect::<String>();
|
||||
|
|
Loading…
Reference in a new issue