Skip to content

Latest commit

 

History

History
97 lines (55 loc) · 2.67 KB

onion_random.md

File metadata and controls

97 lines (55 loc) · 2.67 KB

Module onion_random

Utilities for working with random data.

Authors: Alexander Færøy (ahf@0x90.dk).

Description

Function Index

bytes/1Return N random bytes.
bytes_unsigned/1Return N random bytes as an unsigned integer.
coin_toss/0Toss a coin.
hostname/4Return random hostname.
pick/1Return a random element from a given list.
time_range/2Return an UNIX epoch within Start and End.

Function Details

bytes/1


bytes(N) -> RandomBytes
  • N = non_neg_integer()
  • RandomBytes = binary()

Return N random bytes.

bytes_unsigned/1


bytes_unsigned(N) -> RandomUnsigned
  • N = non_neg_integer()
  • RandomUnsigned = non_neg_integer()

Return N random bytes as an unsigned integer.

coin_toss/0


coin_toss() -> head | tail

Toss a coin.

hostname/4


hostname(Min, Max, Prefix, Suffix) -> inet:hostname()
  • Min = non_neg_integer()
  • Max = non_neg_integer()
  • Prefix = string()
  • Suffix = string()

Return random hostname.

pick/1


pick(List) -> Element
  • Element = term()
  • List = [Element]

Return a random element from a given list.

time_range/2


time_range(Min, Max) -> Result
  • Min = non_neg_integer()
  • Max = non_neg_integer()
  • Result = non_neg_integer()

Return an UNIX epoch within Start and End.