julia> using Random, StaticNumbers
julia> v = zeros(UInt8, 2^16);
julia> rand!(v, UInt8(0):UInt8(2));
julia> rand!(v, static(UInt8(0)):static(UInt8(2)));
ERROR: InexactError: check_top_bit(UInt64, -1)
Stacktrace:
[1] throw_inexacterror(f::Symbol, #unused#::Type{UInt64}, val::Int64)
@ Core ./boot.jl:635
[2] check_top_bit
@ ./boot.jl:649 [inlined]
[3] toUInt64
@ ./boot.jl:760 [inlined]
[4] UInt64(x::Int64)
@ Core ./boot.jl:790
[5] UInt64(#unused#::StaticInteger{-1})
@ StaticNumbers ~/.julia/packages/StaticNumbers/StsSi/src/StaticNumbers.jl:160
[6] convert(#unused#::Type{UInt64}, x::StaticInteger{-1})
@ Base ./number.jl:7
[7] rem(x::StaticInteger{-1}, T::Type{UInt64})
@ Base ./int.jl:600
[8] +(a::StaticInteger{-1}, b::UInt64)
@ Base ./int.jl:1040
[9] last(r::LengthUnitRange{Int64, StaticInteger{-1}, StaticInteger{0x0000000000000003}})
@ StaticNumbers ~/.julia/packages/StaticNumbers/StsSi/src/LengthRanges.jl:119
[10] isempty(r::LengthUnitRange{Int64, StaticInteger{-1}, StaticInteger{0x0000000000000003}})
@ Base ./range.jl:662
[11] Random.SamplerRangeNDL(r::LengthUnitRange{Int64, StaticInteger{-1}, StaticInteger{0x0000000000000003}})
@ Random ~/tmp/julia-61afe7b7f0/share/julia/stdlib/v1.10/Random/src/generation.jl:333
[12] Random.Sampler(#unused#::Type{TaskLocalRNG}, r::LengthUnitRange{Int64, StaticInteger{-1}, StaticInteger{0x0000000000000003}}, #unused#::Val{Inf})
@ Random ~/tmp/julia-61afe7b7f0/share/julia/stdlib/v1.10/Random/src/generation.jl:189
[13] Random.Sampler(rng::TaskLocalRNG, x::LengthUnitRange{Int64, StaticInteger{-1}, StaticInteger{0x0000000000000003}}, r::Val{Inf})
@ Random ~/tmp/julia-61afe7b7f0/share/julia/stdlib/v1.10/Random/src/Random.jl:140
[14] Random.Sampler(rng::TaskLocalRNG, x::LengthUnitRange{Int64, StaticInteger{-1}, StaticInteger{0x0000000000000003}})
@ Random ~/tmp/julia-61afe7b7f0/share/julia/stdlib/v1.10/Random/src/Random.jl:140
[15] rand!(rng::TaskLocalRNG, A::Vector{UInt8}, X::LengthUnitRange{Int64, StaticInteger{-1}, StaticInteger{0x0000000000000003}})
@ Random ~/tmp/julia-61afe7b7f0/share/julia/stdlib/v1.10/Random/src/Random.jl:269
[16] rand!(A::Vector{UInt8}, X::LengthUnitRange{Int64, StaticInteger{-1}, StaticInteger{0x0000000000000003}})
@ Random ~/tmp/julia-61afe7b7f0/share/julia/stdlib/v1.10/Random/src/Random.jl:266
[17] top-level scope
@ REPL[7]:1