Crate nois

source ·
Expand description

nois

nois is a collection of utilities to help you interact with the Nois network Use this library to :

  • Integrate your app with the nois proxy.
  • Safely transform and manipulate your randomness.

Structs

Enums

Constants

  • Max length that the job ID is allowed to have (in bytes)

Traits

Functions

  • Takes a randomness and returns the result of a coinflip (heads or tails).
  • Derives a random integer in the range [begin, end], i.e. including both bounds. Use this method to avoid a modulo bias.
  • Derives random integers in the range [begin, end], i.e. including both bounds. Use this method to avoid a modulo bias. The resulting vector will contain exactly count elements.
  • Picks n elements from a given list.
  • Returns a Decimal d with 0 <= d < 1
  • Takes a hex string and decodes it. Input must be 64 hex characters long (32 bytes).
  • Creates a predictable randomness seed
  • Returns a number from 1-6.
  • Selects one element from a given weighted list.
  • Shuffles a vector using the Fisher-Yates algorithm.
  • Takes a randomness and a key. Returns an arbitrary number of sub-randomnesses.
  • Takes a randomness and a key. Returns an arbitrary number of sub-randomnesses. The key is mixed into the randomness such that calling this function with different keys leads to different outputs. Calling it with the same key and randomness leads to the same outputs.