-
-
Notifications
You must be signed in to change notification settings - Fork 474
Closed
Labels
C-optimisationP-lowPriority: LowPriority: LowP-postponeWaiting on something elseWaiting on something else
Description
I noticed that Rng::gen
and Rng::fill
don't do the same thing on arrays and have different results when the element size is small:
rng.gen()
essentially does[rng.gen(), rng.gen(), ..., rng.gen()]
rng.fill(&mut buf)
castsbuf
to&mut [u8]
then usesRngCore::fill_bytes
— more efficient, and only implemented for integer arrays/slices
We likely want to keep the current behaviour for rng.gen()
when the element type is f32
/f64
/complex types, but for integer types can we optimise to use fill_bytes
?
Metadata
Metadata
Assignees
Labels
C-optimisationP-lowPriority: LowPriority: LowP-postponeWaiting on something elseWaiting on something else