Remove dependency on the rand crate

This commit is contained in:
Dmytro Meleshko
2019-11-05 22:57:26 +02:00
parent ddaf024b81
commit f8359c14fa
2 changed files with 3 additions and 15 deletions

View File

@@ -18,7 +18,6 @@ path = "src/sdl2/lib.rs"
[dependencies]
bitflags = "^1"
libc = "^0.2"
rand = "^0.6"
lazy_static = "^1"
[dependencies.num]
@@ -33,6 +32,9 @@ version = "^0.32"
version = ">= 1.0, <= 1.3"
optional = true
[dev-dependencies]
rand = "^0.7"
[features]
unsafe_textures = []

View File

@@ -1,7 +1,3 @@
extern crate rand;
use self::rand::Rng;
use self::rand::distributions::{Distribution, Standard};
use num::FromPrimitive;
use std::mem::transmute;
use std::convert::TryFrom;
@@ -171,16 +167,6 @@ impl From<(u8, u8, u8, u8)> for Color {
}
}
impl Distribution<Color> for Standard {
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Color {
if rng.gen() {
Color::RGBA(rng.gen(), rng.gen(), rng.gen(), rng.gen())
} else {
Color::RGB(rng.gen(), rng.gen(), rng.gen())
}
}
}
pub struct PixelMasks {
/// Bits per pixel; usually 15, 16, or 32
pub bpp: u8,