diff options
Diffstat (limited to 'srchr/src/layout.rs')
| -rw-r--r-- | srchr/src/layout.rs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/srchr/src/layout.rs b/srchr/src/layout.rs index cc963c7..3a70dc1 100644 --- a/srchr/src/layout.rs +++ b/srchr/src/layout.rs @@ -1,3 +1,19 @@ +// Copyright (C) 2022 tslil clingman +// +// This file is part of srchr. +// +// srchr is free software: you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the Free Software +// Foundation, either version 3 of the License, or (at your option) any later +// version. +// +// srchr is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +// A PARTICULAR PURPOSE. See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with +// srchr. If not, see <https://www.gnu.org/licenses/>. + use crate::config::*; use crate::corpus::*; use crate::output::*; @@ -41,12 +57,15 @@ impl Prelayout { saved = standard_columns[target_col][target_idx]; } - let source_col: usize; + let mut source_col: usize; let source_idx: usize; if source_index { source_col = rng.gen_range(0..2); source_idx = rng.gen_range(0..6); if target_index { + while source_col != target_col { + source_col = rng.gen_range(0..2) + } index_columns[target_col][target_idx] = index_columns[source_col][source_idx]; } else { standard_columns[target_col][target_idx] = @@ -60,6 +79,9 @@ impl Prelayout { index_columns[target_col][target_idx] = standard_columns[source_col][source_idx]; } else { + while source_col != target_col { + source_col = rng.gen_range(0..6); + } standard_columns[target_col][target_idx] = standard_columns[source_col][source_idx]; } |
