random_gib v0.0.8 RandomGib.Get

GenServer that contains simple functions for getting random things like letters, characters, etc.

I created this when first learning Elixir. It probably should not be a GenServer and I’ll probably need to change that, but I like my syntax.

Summary

Functions

Generates a new seed

Gets a single random item from a list

Gets a string of characters with length count, drawing from the bitstring valid_characters, which defaults to a-z, A-Z and a bunch of special characters

Gets some random letters of a given count. Returns a string

Gets some subset of a given source list or bitstring string

Functions

generate_seed(algorithm \\ :exs1024)

Generates a new seed.

Examples

iex> RandomGib.Get.generate_seed() :ok

one_of(src)

Gets a single random item from a list.

some_characters(count, valid_characters \\ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-_=+[]{}\\|;:'\"<>,.?/")

Gets a string of characters with length count, drawing from the bitstring valid_characters, which defaults to a-z, A-Z and a bunch of special characters.

Examples

result = RandomGib.Get.some_characters(5)

result = RandomGib.Get.some_characters(5, “abcdefgh*^&%”)

some_letters(count)

Specs

some_letters(pos_integer) :: String.t

Gets some random letters of a given count. Returns a string.

Examples

result = RandomGib.some_letters(5)

some_of(src)

Gets some subset of a given source list or bitstring string.