1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-15 19:36:16 +00:00

test_sort: use Pcg32 random number generator

This commit is contained in:
Niyaz Nigmatullin 2022-09-12 19:36:51 +03:00
parent ec8e610e48
commit 729d97e993
3 changed files with 14 additions and 3 deletions

View file

@ -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>();