fn main()

in common/datagen/datagen.rs [102:168]


fn main() {
    env_logger::init();

    let matches = App::new("Protocol testing")
        .version("0.1")
        .about("Permutations testing")
        .arg(
            Arg::with_name("dir")
                .short("d")
                .long("dir")
                .value_name("DIR")
                .help("output dir")
                .takes_value(true)
                .default_value("./"),
        )
        .arg(
            Arg::with_name("size")
                .short("n")
                .long("size")
                .value_name("SIZE")
                .help("size_of_dataset")
                .takes_value(true)
                .default_value("10"),
        )
        .arg(
            Arg::with_name("cols")
                .short("c")
                .long("cols")
                .value_name("COLS")
                .help("extra columns")
                .takes_value(true)
                .default_value("0"),
        )
        .get_matches();

    let size = matches
        .value_of("size")
        .unwrap()
        .parse::<usize>()
        .expect("size param");

    let cols = matches
        .value_of("cols")
        .unwrap()
        .parse::<usize>()
        .expect("size param");
    let dir = matches.value_of("dir").unwrap_or("./");

    let fn_a = format!("{}/input_{}_size_{}_cols_{}.csv", dir, "a", size, cols);
    let fn_b = format!("{}/input_{}_size_{}_cols_{}.csv", dir, "b", size, cols);

    info!("Generating output of size {}", size);
    info!("Player a output: {}", fn_a);
    info!("Player b output: {}", fn_b);

    let intrsct = size / 2 as usize;
    let size_player = size - intrsct;
    let data = gen::random_data(size_player, size_player, intrsct);
    info!("Data generation done, writing to files");
    gen::write_slice_to_file(&data.player_a, cols, &fn_a).unwrap();
    info!("File {} finished", fn_a);

    gen::write_slice_to_file(&data.player_b, cols, &fn_b).unwrap();
    info!("File {} finished", fn_b);

    info!("Bye!");
}