1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

rand: simplify rand.PRNG, move to optional types for error handling (#13570)

This commit is contained in:
Subhomoy Haldar
2022-02-23 16:06:14 +05:30
committed by GitHub
parent 5c0b7b0d05
commit 114a341f5f
49 changed files with 609 additions and 1586 deletions

View File

@ -68,10 +68,11 @@ pub fn (mut s System) explode(x f32, y f32) {
p = s.bin[i]
p.reset()
p.location.from(center)
p.acceleration = vec2.Vec2{rand.f32_in_range(-0.5, 0.5), rand.f32_in_range(-0.5,
0.5)}
p.velocity = vec2.Vec2{rand.f32_in_range(-0.5, 0.5), rand.f32_in_range(-0.5, 0.5)}
p.life_time = rand.f64_in_range(500, 2000)
p.acceleration = vec2.Vec2{rand.f32_in_range(-0.5, 0.5) or { -0.5 }, rand.f32_in_range(-0.5,
0.5) or { -0.5 }}
p.velocity = vec2.Vec2{rand.f32_in_range(-0.5, 0.5) or { -0.5 }, rand.f32_in_range(-0.5,
0.5) or { -0.5 }}
p.life_time = rand.f64_in_range(500, 2000) or { 500 }
s.pool << p
s.bin.delete(i)
reserve--