starchart/src/stars/position.rs

24 lines
478 B
Rust

use fastrand::Rng;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(JsonSchema, Serialize, Deserialize, Clone, Copy)]
pub struct Position {
pub right: f64,
pub bottom: f64,
pub width: u8,
}
impl Position {
pub fn random(seed: u64) -> Self {
let mut rand = Rng::with_seed(seed);
Self {
right: rand.f64() * 100.0,
bottom: rand.f64() * 100.0,
width: rand.u8(24..112),
}
}
}