API referencestd/crypto

std/crypto/random

Public declarations, types, methods, and source contracts for std/crypto/random.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "std/crypto/random"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
crypto std/crypto random.dodo
hash std/hash random.dodo
native std/crypto/native random.dodo
ptr core/ptr random.dodo

fill

Function · Source

Fills output completely. On error the contents of output are unspecified and must not be used as random bytes.

pub fn fill(output: &mut[u8]) -> void!crypto.Error

next_u64

Function · Source

A uniformly distributed u64.

pub fn next_u64() -> u64!crypto.Error

below

Function · Source

A uniformly distributed value in 0..bound, without modulo bias. bound must be nonzero.

pub fn below(bound: u64) -> u64!crypto.Error

key

Function · Source

A random SipHash key for keyed hash maps.

pub fn key() -> hash.Key128!crypto.Error

SystemRandom

Struct · Source

Stateless OS source with the hash.obtain_key capability, for code that takes its entropy source as a parameter.

pub struct SystemRandom {

}

SystemRandom.new

Function · Source

pub fn new() -> SystemRandom

SystemRandom.fill

Function · Source

pub fn fill(&mut self, output: &mut[u8]) -> void!crypto.Error

SystemRandom.next_key

Function · Source

pub fn next_key(&mut self) -> hash.Key128!hash.KeyError

Search every guide, reference page, and API declaration.