summaryrefslogtreecommitdiff
path: root/src/math.rs
blob: 127d4b42d3c79f3e1be49e8224840885d409b6ac (plain)
1
2
3
4
5
6
7
8
9
10
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()
}