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

27 lines
513 B
V
Raw Normal View History

2020-02-03 07:00:36 +03:00
// Copyright (c) 2019-2020 Alexander Medvednikov. All rights reserved.
2019-07-31 04:24:12 +03:00
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
module rand
const (
2019-10-29 19:59:55 +03:00
read_error = error('crypto.rand.read() error reading random bytes')
2019-07-31 04:24:12 +03:00
)
// NOTE: temp until we have []bytes(buff)
2020-04-14 22:03:02 +03:00
fn c_array_to_bytes_tmp(len int, buffer voidptr) []byte {
2020-04-10 19:11:43 +03:00
mut arr := []byte{len:len, cap:1}
2020-04-10 19:11:43 +03:00
arr.data = buffer
/*
2019-07-31 04:24:12 +03:00
arr = array {
len: len
cap: 1
element_size: 1
data: buffer
}
2020-04-10 19:11:43 +03:00
*/
2019-07-31 04:24:12 +03:00
return arr
}