You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: type mismatch: got <HSlice[system.float, system.float64]>
but expected one of:
proc rand(max: int): int
proc rand[T: Ordinal](x: HSlice[T, T]): T
proc rand(r: var Rand; max: Natural): int
proc rand[T](r: var Rand; a: openArray[T]): T
proc rand(max: float): float
proc rand[T: SomeInteger](t: typedesc[T]): T
proc rand(r: var Rand; max: range[0.0 .. high(float)]): float
proc rand[T](a: openArray[T]): T
proc rand[T: Ordinal](r: var Rand; x: HSlice[T, T]): T
expression: rand(-0.1 .. 0.1)
The text was updated successfully, but these errors were encountered:
Looking again it's not the slice, I thought for 1 moment that float and float64 were not aliases anymore.
The issue is the new Ordinal requirement: #10998 which was introduced to fix #7698 (allow rand on enums).
We probably need an overload just for floats.
This reminds of Rust that has a Ord trait for ordinal types with equality cleanly defined and PartialOrd trait for types like floats that are usually ordinal except for specific values (NaN is not equal to itself).
This works on 0.19.4 but doesn't on devel
Error is:
The text was updated successfully, but these errors were encountered: