summaryrefslogtreecommitdiff
path: root/src/math.rs
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2018-04-12 04:33:23 -0500
committertom barrett <spalf0@gmail.com>2018-04-12 04:33:23 -0500
commit573ba69d810914c153a578747414b3d631e61bbc (patch)
tree4ce164db9d28ede9778d75ddb4f6922ea1dc1a91 /src/math.rs
parentab797e7f30e5e8913faf73516346129b9a620550 (diff)
completely restructured code and fixed navigation bug
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()
+}