Browse Source

un-got

master
Thomas Johnson 3 years ago
parent
commit
c20e360c5a
  1. 8
      src/clause_gen.rs

8
src/clause_gen.rs

@ -21,9 +21,9 @@ fn get_var_name(n: usize) -> String {
/*
* Returns a list of integers from 0 to (n-1) in a random order.
*/
fn get_rand_list(n: usize) -> Vec<usize> {
let mut int_list: Vec<usize> = (0..n).collect();
let mut r_list: Vec<usize> = Vec::new();
fn get_rand_list(n : usize) -> Vec<usize> {
let mut int_list : Vec<usize> = (0..n).collect();
let mut r_list : Vec<usize> = Vec::new();
for _ in 0..n {
let idx: usize = rand::random::<usize>() % int_list.len();
r_list.push(int_list.remove(idx));
@ -48,7 +48,7 @@ pub fn gen_clause(var_list: &[Variable]) -> Clause {
*/
pub fn gen_clause_list(count: usize, max_vars: usize) -> ClauseList {
let mut cls = ClauseList::new();
let vars: Vec<Variable> = get_rand_list(max_vars)
let vars : Vec<Variable> = get_rand_list(max_vars)
.into_iter()
.map(get_var_name)
.map(Variable::from_name)

Loading…
Cancel
Save