summaryrefslogtreecommitdiff
path: root/src/math.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/math.rs')
-rw-r--r--src/math.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/math.rs b/src/math.rs
index 6766a60..127d4b4 100644
--- a/src/math.rs
+++ b/src/math.rs
@@ -1,3 +1,11 @@
+extern crate rand;
+
+use self::rand::Rng;
+
pub fn distance(l0 : (f64, f64, f64), l1 : (f64, f64, f64)) -> f64 {
(((l1.0-l0.0).powf(2.0) + (l1.1-l0.1).powf(2.0) + (l1.2-l0.2).powf(2.0))).sqrt()
}
+
+pub fn rand_name() -> String {
+ rand::thread_rng().gen_ascii_chars().take(8).collect()
+}