summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hitomezashi.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/hitomezashi.rs b/src/hitomezashi.rs
index 9ec8758..8e2a773 100644
--- a/src/hitomezashi.rs
+++ b/src/hitomezashi.rs
@@ -36,6 +36,10 @@ pub fn hitomezashi(width: usize, height: usize, skew: Option<f64>) {
// skew=0.5 generates the most random-looking patterns
let skew: f64 = skew.unwrap_or(0.5);
+ assert!(width >= 1, "Width must be a positive number!");
+ assert!(height >= 1, "Height must be a positive number!");
+ assert!(skew >= 0.0 && skew <= 1.0, "Skew must be between zero and one inclusive!");
+
let mut rng = rand::thread_rng();
let brn = Bernoulli::new(skew).unwrap();