mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #6176 from BenWiederhake/dev-fuzz-emptystring
fuzz: also generate the empty string sometimes
This commit is contained in:
commit
8f791da213
1 changed files with 1 additions and 1 deletions
|
@ -374,7 +374,7 @@ pub fn generate_random_string(max_length: usize) -> String {
|
|||
let invalid_utf8 = [0xC3, 0x28]; // Invalid UTF-8 sequence
|
||||
let mut result = String::new();
|
||||
|
||||
for _ in 0..rng.gen_range(1..=max_length) {
|
||||
for _ in 0..rng.gen_range(0..=max_length) {
|
||||
if rng.gen_bool(0.9) {
|
||||
let ch = valid_utf8.choose(&mut rng).unwrap();
|
||||
result.push(*ch);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue