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

@@ -22,6 +22,12 @@ mut:
extra u32
}
// free should be called when the generator is no longer needed
[unsafe]
pub fn (mut rng WyRandRNG) free() {
unsafe { free(rng) }
}
// seed sets the seed, needs only two `u32`s in little-endian format as [lower, higher].
pub fn (mut rng WyRandRNG) seed(seed_data []u32) {
if seed_data.len != 2 {