Skip to content

duff/random_bytes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RandomBytes

Generate random strings.

Installation

Add random_bytes to your list of dependencies in mix.exs:

  def deps do
    [{:random_bytes, "~> 1.0"}]
  end

Usage

Generate a random base62 string:

iex> RandomBytes.base62
"HMVrjeb1GvIPSlqVbZhHig"
iex> RandomBytes.base62(28)
"KDGpJ5xQsQSTnIUZN4CZcetG3yDSZXWzrwM6BA"
iex> RandomBytes.base62(9)
"88XuyJDWK2LA"

Generate a random base16 string:

iex> RandomBytes.base16
"e1d227efd5ae7d359fb6a3fff23ae44e"
iex> RandomBytes.base16(4)
"bc859e88"

Generate a UUID:

iex> RandomBytes.uuid
"6c2bc294-a8f4-4d64-8fb4-5fda8b1d7763"

License

RandomBytes source code is released under the Apache 2 License (same as Elixir). Check LICENSE file for more information.

About

Generate random strings in Elixir

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages