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§
- Nois
Callback - This must be accepted in an
NoisReceive { callback: NoisCallback }
enum case in the ExecuteMsg of the app. - SubRandomness
Provider
Enums§
- Proxy
Execute Msg - Randomness
From StrErr - Receiver
Execute Msg - This is just a helper to properly serialize the above callback. The actual receiver should include this variant in the larger ExecuteMsg enum.
- Side
- The side of a coin. This is the result type of
coinflip
Constants§
- MAX_
JOB_ ID_ LEN - Max length that the job ID is allowed to have (in bytes)
Traits§
- Int
- A trait to restrict int types for
int_in_range
Functions§
- coinflip
- Takes a randomness and returns the result of a coinflip (heads or tails).
- int_
in_ range - Derives a random integer in the range [begin, end], i.e. including both bounds. Use this method to avoid a modulo bias.
- ints_
in_ range - 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. - pick
- Picks
n
elements from a given list. - random_
decimal - Returns a Decimal d with 0 <= d < 1
- randomness_
from_ str - Takes a hex string and decodes it. Input must be 64 hex characters long (32 bytes).
- randomness_
simulator - Creates a predictable randomness seed
- roll_
dice - Returns a number from 1-6.
- select_
from_ weighted - Selects one element from a given weighted list.
- shuffle
- Shuffles a vector using the Fisher-Yates algorithm.
- sub_
randomness - Takes a randomness and a key. Returns an arbitrary number of sub-randomnesses.
- sub_
randomness_ with_ key - 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.