From 573ba69d810914c153a578747414b3d631e61bbc Mon Sep 17 00:00:00 2001 From: tom barrett Date: Thu, 12 Apr 2018 04:33:23 -0500 Subject: completely restructured code and fixed navigation bug --- src/math.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/math.rs') 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() +} -- cgit v1.2.3