aboutsummaryrefslogtreecommitdiff
path: root/server/src/lib.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-10-10 18:06:37 +0200
committermetamuffin <metamuffin@disroot.org>2025-10-10 18:06:37 +0200
commit3fe8ba7f1b9fa7e38fa03f55fd898c8ca2a0e996 (patch)
treec3913fce710a879e2375c60a2b78e0cad483de18 /server/src/lib.rs
parentf78856e4cd4928c790748b883b7916585980b3dd (diff)
downloadhurrycurry-3fe8ba7f1b9fa7e38fa03f55fd898c8ca2a0e996.tar
hurrycurry-3fe8ba7f1b9fa7e38fa03f55fd898c8ca2a0e996.tar.bz2
hurrycurry-3fe8ba7f1b9fa7e38fa03f55fd898c8ca2a0e996.tar.zst
Update to newest rust; replace rand with std random
Diffstat (limited to 'server/src/lib.rs')
-rw-r--r--server/src/lib.rs10
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.
+}