diff options
Diffstat (limited to 'server/src/lib.rs')
| -rw-r--r-- | server/src/lib.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/server/src/lib.rs b/server/src/lib.rs index da49f85d..2d3a62cc 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -15,7 +15,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#![feature(if_let_guard, let_chains, iterator_try_collect, stmt_expr_attributes)] +#![feature(if_let_guard, iterator_try_collect, stmt_expr_attributes, random)] pub mod commands; pub mod entity; pub mod interaction; @@ -25,6 +25,7 @@ pub mod server; pub mod state; use hurrycurry_protocol::glam::Vec2; +use std::random::random; #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct ConnectionID(pub i64); @@ -43,3 +44,10 @@ impl InterpolateExt for f32 { *self = target + (*self - target) * (-dt).exp(); } } + +fn random_float() -> f32 { + random::<u32>(..) as f32 / u32::MAX as f32 +} +fn random_gauss() -> f32 { + [(); 12].map(|()| random_float()).iter().sum::<f32>() - 6. +} |