[ANN] RandomExtensions.jl - randomness for all

I’m very pleased to announce the RandomExtensions.jl package: this started out as a PR against the Random module before the 1.0 release of Julia, which was wisely not merged.
But after a couple more iterations on the design, it now feels ready for public consumption. My hope is that user feed-back will allow eventually to incorporate back some functionalities into Random, in some form or another.

Essentially, it allows to create new “scalars”, like pairs or tuples, via a make function:

julia> rand(make(Tuple, 1:9, UInt8, String))
(2, 0xf4, "0CLgPODQ")

and extends the rand API to allow creating other containers than arrays:

julia> rand(make(Pair, 1:9, UInt8), Dict, 3)
Dict{Int64,UInt8} with 3 entries:
  9 => 0xc4
  3 => 0x92
  5 => 0x11

This is of course easily extensible for user-defined types. See the README for more examples. Bug reports and contributions (code or ideas) are very welcome!

11 Likes