WeightedRandom.Utils.Crypto (weighted_random v1.0.0-rc.1)

Copy Markdown View Source

Based on this blog post run reseed, to generate a cryptographically secure seed for your random number generators.

I would actually argue every elixir app should call this function at the beginning of it's startup process, even if the WeightedRandom library is not being used.

Usage

# my_app/lib/my_app/application.ex
defmodule MyApp.Application do
  use Application

  @impl true
  def start(_type, _args) do
    WeightedRandom.Utils.Crypto.reseed()
    children = [
      ...
    ]
    opts = [...]
    Supervisor.start_link(children, opts)
  end
end

Summary

Functions

Takes no arguments, and has no meaningful return value. This function sets the current random seed to something more cryptographically secure.

Functions

reseed()

Takes no arguments, and has no meaningful return value. This function sets the current random seed to something more cryptographically secure.