Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pendletong/randomlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

randomlib

Package Version Hex Docs

A random number library for Gleam

This package provides various function to generate random output for different types The random generation should be the same between Erlang and Javascript targets

gleam add randomlib@1
import randomlib

pub fn main() {
  randomlib.choice(randomlib.new(), ["Red", "Green", "Blue"])

  let #(val, rnd) = randomlib.next_byte(randomlib.with_seed(13470613))
  let #(val2, rnd) = randomlib.next_float(rnd)

  io.debug(val)
  io.debug(val2)

}
// -> 50
// -> 0.9460694304884285

Further documentation can be found at https://hexdocs.pm/randomlib.

Development

gleam run   # Run the project
gleam test  # Run the tests

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages