format and update Cargo.lock
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -172,7 +172,7 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "no-more-secret"
|
name = "no-more-secrets"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rand",
|
"rand",
|
||||||
|
|||||||
15
src/main.rs
15
src/main.rs
@@ -88,11 +88,10 @@ impl Cipher {
|
|||||||
match m {
|
match m {
|
||||||
true => print!("{c}"),
|
true => print!("{c}"),
|
||||||
false => {
|
false => {
|
||||||
if rand::random_range(0..100)<update_prob{
|
if rand::random_range(0..100) < update_prob {
|
||||||
let idx = rand::random_range(0..CHARSET.len());
|
let idx = rand::random_range(0..CHARSET.len());
|
||||||
print!("{}", CHARSET[idx]);
|
print!("{}", CHARSET[idx]);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
print!("\x1b[1C");
|
print!("\x1b[1C");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,7 +113,7 @@ impl Cipher {
|
|||||||
self.mask[idx[selected]] = true;
|
self.mask[idx[selected]] = true;
|
||||||
idx[selected] = idx[offset];
|
idx[selected] = idx[offset];
|
||||||
|
|
||||||
if offset == (idx.len()-1){
|
if offset == (idx.len() - 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,12 +138,12 @@ async fn main() {
|
|||||||
cipher.reset();
|
cipher.reset();
|
||||||
cipher.display(20);
|
cipher.display(20);
|
||||||
sleep(Duration::from_millis(100)).await;
|
sleep(Duration::from_millis(100)).await;
|
||||||
|
|
||||||
if cipher.random_unmask(10){
|
if cipher.random_unmask(10) {
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cipher.reset();
|
cipher.reset();
|
||||||
cipher.display(100);
|
cipher.display(100);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user