Initial project import
This commit is contained in:
commit
23f2d29e32
11957 files changed
+1754577
No files matched your search
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved.
|
||||
// Use of this source code is governed by an MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
module rand
|
||||
|
||||
struct ReadError {
|
||||
Error
|
||||
}
|
||||
|
||||
// msg returns the error message.
|
||||
pub fn (err ReadError) msg() string {
|
||||
return 'crypto.rand.read() error reading random bytes'
|
||||
}
|
||||
|
||||
// bytes returns an array of `bytes_needed` random bytes.
|
||||
// Note: this call can block your program for a long period of time,
|
||||
// if your system does not have access to enough entropy.
|
||||
// See also rand.bytes(), if you do not need really random bytes,
|
||||
// but instead pseudo random ones, from a pseudo random generator
|
||||
// that can be seeded, and that is usually faster.
|
||||
pub fn bytes(bytes_needed int) ![]u8 {
|
||||
return read(bytes_needed)
|
||||
}
|
||||
Reference in new issue
Block a user