fixed Distribution
This commit is contained in:
parent
36bcdd1518
commit
c18b32660a
|
@ -1,3 +1,4 @@
|
||||||
|
use rand::Rng;
|
||||||
use skunk2d::*;
|
use skunk2d::*;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@ struct World {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
rand::thread_rng().gen::<Direction>();
|
||||||
run::<World>(WIDTH, HEIGHT);
|
run::<World>(WIDTH, HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use crate::{Image, Tileset, Vec2};
|
use crate::{Image, Tileset, Vec2};
|
||||||
|
use rand::distributions::Standard;
|
||||||
use rand::prelude::Distribution;
|
use rand::prelude::Distribution;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
@ -128,7 +129,7 @@ impl HexMap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Distribution<Direction> for Direction {
|
impl Distribution<Direction> for Standard {
|
||||||
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Direction {
|
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Direction {
|
||||||
match rng.gen_range(0..6) {
|
match rng.gen_range(0..6) {
|
||||||
0 => Direction::North,
|
0 => Direction::North,
|
||||||
|
|
Loading…
Reference in New Issue