`support/arbitrary`: Instead of uniform random sampling, we should use a distribution that
- Lingua principale
- Rust
- Stelle
- 225
- Fork
- 70
- Merge medio
- 16h 54m
- PR unite (30g)
- 8
Descrizione
*On 2022-10-28 @recmo wrote in [`49f6271`](https://github.com/recmo/uint/commit/49f6271d9967c55a71f588ed267387b57a285d43) “Merge pull request #195 from recmo/pow2”:*
Instead of uniform random sampling, we should use a distribution that
exercises different scales more. Something like sum(±2ⁱ for random i). The
reduction step can then remove terms or make them smaller.
```rust
#![cfg(feature = "arbitrary")]
#![cfg_attr(has_doc_cfg, doc(cfg(feature = "arbitrary")))]
use crate::Uint;
use arbitrary::{Arbitrary, Result, Unstructured};
// TODO: Instead of uniform random sampling, we should use a distribution that
// exercises different scales more. Something like sum(±2ⁱ for random i). The
// reduction step can then remove terms or make them smaller.
// TODO: We should use `rand` in tests, not `arbitrary`.
impl<'a, const BITS: usize, const LIMBS: usize> Arbitrary<'a> for Uint {
fn arbitrary(u: &mut Unstructured<'a>) -> Result {
```
*From [`src/support/arbitrary.rs:7`](https://github.com/recmo/uint/blob/49f6271d9967c55a71f588ed267387b57a285d43/src/support/arbitrary.rs#L7)*
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.