Browse Source

bumped rand version

master
Thomas Johnson 6 months ago
parent
commit
789644e19a
  1. 10
      src/world/gen.rs

10
src/world/gen.rs

@ -5,8 +5,8 @@ use rogue_util::grid::{Grid};
use rogue_util::raster;
use super::{Tile, Content};
use rand::rngs::SmallRng;
use rand::{Rng, SeedableRng};
use rand_distr::{Poisson, Distribution, weighted::WeightedIndex, Uniform, Bernoulli};
use rand::{Rng, SeedableRng, distributions::WeightedIndex};
use rand_distr::{Poisson, Distribution, Uniform, Bernoulli};
use std::hash::{Hash, Hasher};
use std::collections::hash_map::DefaultHasher;
@ -160,7 +160,7 @@ fn get_room_shapes(seed: u64, coords: V2i) -> Vec<RoomShape>
coords.hash(&mut hasher);
let mut rg = SmallRng::seed_from_u64(hasher.finish());
let nrooms: u64 = Poisson::new(AVG_ROOMS_PER_CELL).unwrap().sample(&mut rg);
let nrooms: u64 = Poisson::new(AVG_ROOMS_PER_CELL).unwrap().sample(&mut rg) as u64;
let mut rooms = Vec::new();
let chooser = WeightedIndex::new(&ROOM_TYPE_WEIGHTS).unwrap();
@ -299,7 +299,7 @@ fn carve_between(seed: u64, coords: V2i, rs1: &RoomShape, rs2: &RoomShape) -> Op
let area = xd * yd;
if area == 0 { return None; }
let npoints: u64 = Poisson::new(PATH_ORTHOG_AVG_NUM_STOPS_PER_LEN * (area as f64).sqrt())
.unwrap().sample(&mut rg);
.unwrap().sample(&mut rg) as u64;
let mut tpoints = Vec::new();
tpoints.push(ep1);
for _ii in 0 .. npoints
@ -346,7 +346,7 @@ fn carve_between(seed: u64, coords: V2i, rs1: &RoomShape, rs2: &RoomShape) -> Op
let area = xd * yd;
if area == 0 { return None; }
let npoints: u64 = Poisson::new(PATH_CIRC_AVG_NUM_STOPS_PER_LEN * (area as f64).sqrt())
.unwrap().sample(&mut rg);
.unwrap().sample(&mut rg) as u64;
let mut tpoints = Vec::new();
tpoints.push(ep1);
for _ii in 0 .. npoints

Loading…
Cancel
Save