mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
rand: extend PRNG interface, add buffering support (#13608)
This commit is contained in:
parent
efeb3e04da
commit
a0d9e6e1c2
9 changed files with 380 additions and 110 deletions
|
@ -66,9 +66,8 @@ pub fn ulid_at_millisecond(unix_time_milli u64) string {
|
|||
return res
|
||||
}
|
||||
|
||||
// read fills in `buf` a maximum of `buf.len` random bytes
|
||||
pub fn read(mut buf []byte) {
|
||||
fn read_internal(mut rng PRNG, mut buf []byte) {
|
||||
for i in 0 .. buf.len {
|
||||
buf[i] = byte(default_rng.u32())
|
||||
buf[i] = rng.byte()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue