As mentioned by others, broadcast
defaults to treating its arguments as collections. Types can opt in to being treated as “scalars” by defining Base.broadcastable(x::MyType) = Ref(x)
, or you can opt-in at the call site with an explicit Ref
.
That being said, I agree that RNG types should opt-in to being treated as scalars. Fortunately, it is a one-line non-breaking change to add this to any existing type: