• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vigna / webgraph-rs / 23365769388

20 Mar 2026 10:52PM UTC coverage: 68.228% (-3.0%) from 71.245%
23365769388

push

github

vigna
No le_bins,be_bins for webgraph

6655 of 9754 relevant lines covered (68.23%)

46582760.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/cli/src/perm/rand.rs
1
/*
2
 * SPDX-FileCopyrightText: 2023 Inria
3
 * SPDX-FileCopyrightText: 2023 Tommaso Fontana
4
 * SPDX-FileCopyrightText: 2026 Sebastiano Vigna
5
 *
6
 * SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
7
 */
8

9
use crate::{IntSliceFormat, create_parent_dir};
10
use anyhow::Result;
11
use clap::Parser;
12
use rand::prelude::SliceRandom;
13
use std::path::PathBuf;
14

15
#[derive(Parser, Debug)]
16
#[command(name = "rand", about = "Creates a random permutation.", long_about = None, next_line_help = true)]
17
pub struct CliArgs {
18
    /// The number of elements in the permutation.​
19
    pub len: usize,
20
    /// The filename of the random permutation.​
21
    pub dst: PathBuf,
22

23
    #[arg(long, value_enum, default_value_t)]
24
    /// The format of the permutation file.​
25
    pub fmt: IntSliceFormat,
26
}
27

28
pub fn main(args: CliArgs) -> Result<()> {
×
29
    create_parent_dir(&args.dst)?;
×
30

31
    let mut rng = rand::rng();
×
32
    let mut perm = (0..args.len).collect::<Vec<_>>();
×
33
    perm.shuffle(&mut rng);
×
34

35
    args.fmt.store(&args.dst, &perm, None)?;
×
36

37
    Ok(())
×
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc