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

rand: fix leaks with -autofree

This commit is contained in:
Delyan Angelov
2021-09-23 11:14:20 +03:00
parent 79e33d92f1
commit 8837712f2b
9 changed files with 63 additions and 6 deletions

View File

@@ -224,3 +224,9 @@ pub fn (mut rng PCG32RNG) f64_in_range(min f64, max f64) f64 {
}
return min + rng.f64n(max - min)
}
// free should be called when the generator is no longer needed
[unsafe]
pub fn (mut rng PCG32RNG) free() {
unsafe { free(rng) }
}