Skip to content

Instantly share code, notes, and snippets.

@awreece
Created June 19, 2012 18:51
Show Gist options
  • Save awreece/2955867 to your computer and use it in GitHub Desktop.
Save awreece/2955867 to your computer and use it in GitHub Desktop.
fn main(args: [str]) {
if vec::len(args) != 2u {
let usage = #fmt("Usage: %s <elem_count>\n", args[0]);
io::stderr().write_str(usage);
os::set_exit_status(-1);
ret;
}
let count = option::get(int::from_str(args[1]));
let rng = rand::seeded_rng(rand::seed());
let fw = result::get(io::buffered_file_writer("vec_gen.out"));
let mut i = 0;
while i < count {
let r = rng.next() & (0x7fffffffu as u32);
fw.write_line(int::to_str(r as int, 10u));
i += 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment