LoadError: ArgumentError: Sampler for this object is not defined

rand expects an AbstractRNG object, not a type. It’s like the difference between 1 and Integer; 1 is an instance of an Int <: Integer, whereas Integer is a type. Hopefully this example helps illustrate:

julia> f(a::Integer) = a
f (generic function with 1 method)

julia> f(::Type{<:Integer}) = "f(Integer) was called"
f (generic function with 2 methods)

julia> f(1)
1

julia> f(Int)
"f(Integer) was called"

rand wants an AbstractRNG object, whereas Random.Sampler just wants the type. Not sure why Random.Sampler just needs the type though.