| 1 |
use craterust-analyzer cargo half 2.7.1 crate/::{bf16rust-analyzer cargo half 2.7.1 bfloat/bf16#, f16rust-analyzer cargo half 2.7.1 binary16/f16#}; |
| 2 |
|
| •3 |
use randrust-analyzer cargo rand 0.10.2 crate/::{distrrust-analyzer cargo rand 0.10.2 distr/::Distributionrust-analyzer cargo rand 0.10.2 distr/distribution/Distribution#, RngExtrust-analyzer cargo rand 0.10.2 rng/RngExt#}; |
| 4 |
use rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::UniformFloatrust-analyzer cargo rand 0.10.2 distr/uniform/float/UniformFloat#; |
| 5 |
|
| 6 |
macro_rules! impl_distribution_via_f32rust-analyzer cargo half 2.7.1 rand_distr/impl_distribution_via_f32! { |
| 7 |
($Ty:ty, $Distr:ty) => { |
| 8 |
impl Distribution<$Ty> for $Distr { |
| •9 |
fn sample<R: RngExt + ?Sized>(&self, rng: &mut R) -> $Ty { |
| 10 |
<$Ty>::from_f32(<Self as Distribution<f32>>::sample(self, rng)) |
| 11 |
} |
| 12 |
} |
| 13 |
}; |
| 14 |
} |
| 15 |
|
| 16 |
impl_distribution_via_f32rust-analyzer cargo half 2.7.1 rand_distr/impl_distribution_via_f32!!(f16rust-analyzer cargo half 2.7.1 binary16/f16#, rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::StandardUniformrust-analyzer cargo rand 0.10.2 distr/StandardUniform#); |
| 17 |
impl_distribution_via_f32rust-analyzer cargo half 2.7.1 rand_distr/impl_distribution_via_f32!!(f16rust-analyzer cargo half 2.7.1 binary16/f16#, rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::StandardNormalrust-analyzer cargo rand_distr 0.6.0 normal/StandardNormal#); |
| 18 |
impl_distribution_via_f32rust-analyzer cargo half 2.7.1 rand_distr/impl_distribution_via_f32!!(f16rust-analyzer cargo half 2.7.1 binary16/f16#, rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::Exp1rust-analyzer cargo rand_distr 0.6.0 exponential/Exp1#); |
| 19 |
impl_distribution_via_f32rust-analyzer cargo half 2.7.1 rand_distr/impl_distribution_via_f32!!(f16rust-analyzer cargo half 2.7.1 binary16/f16#, rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::Open01rust-analyzer cargo rand 0.10.2 distr/float/Open01#); |
| 20 |
impl_distribution_via_f32rust-analyzer cargo half 2.7.1 rand_distr/impl_distribution_via_f32!!(f16rust-analyzer cargo half 2.7.1 binary16/f16#, rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::OpenClosed01rust-analyzer cargo rand 0.10.2 distr/float/OpenClosed01#); |
| 21 |
|
| 22 |
impl_distribution_via_f32rust-analyzer cargo half 2.7.1 rand_distr/impl_distribution_via_f32!!(bf16rust-analyzer cargo half 2.7.1 bfloat/bf16#, rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::StandardUniformrust-analyzer cargo rand 0.10.2 distr/StandardUniform#); |
| 23 |
impl_distribution_via_f32rust-analyzer cargo half 2.7.1 rand_distr/impl_distribution_via_f32!!(bf16rust-analyzer cargo half 2.7.1 bfloat/bf16#, rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::StandardNormalrust-analyzer cargo rand_distr 0.6.0 normal/StandardNormal#); |
| 24 |
impl_distribution_via_f32rust-analyzer cargo half 2.7.1 rand_distr/impl_distribution_via_f32!!(bf16rust-analyzer cargo half 2.7.1 bfloat/bf16#, rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::Exp1rust-analyzer cargo rand_distr 0.6.0 exponential/Exp1#); |
| 25 |
impl_distribution_via_f32rust-analyzer cargo half 2.7.1 rand_distr/impl_distribution_via_f32!!(bf16rust-analyzer cargo half 2.7.1 bfloat/bf16#, rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::Open01rust-analyzer cargo rand 0.10.2 distr/float/Open01#); |
| 26 |
impl_distribution_via_f32rust-analyzer cargo half 2.7.1 rand_distr/impl_distribution_via_f32!!(bf16rust-analyzer cargo half 2.7.1 bfloat/bf16#, rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::OpenClosed01rust-analyzer cargo rand 0.10.2 distr/float/OpenClosed01#); |
| 27 |
|
| 28 |
impl randrust-analyzer cargo rand 0.10.2 crate/::distrrust-analyzer cargo rand 0.10.2 distr/::weightedrust-analyzer cargo rand 0.10.2 distr/weighted/::Weightrust-analyzer cargo rand 0.10.2 distr/weighted/Weight# for f16rust-analyzer cargo half 2.7.1 binary16/f16# { |
| 29 |
const ZEROrust-analyzer cargo half 2.7.1 rand_distr/impl#[f16][Weight]ZERO.: Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[f16][Weight] = Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[f16][Weight]::ZEROrust-analyzer cargo half 2.7.1 binary16/impl#[f16]ZERO.; |
| 30 |
|
| 31 |
fn checked_add_assignrust-analyzer cargo half 2.7.1 rand_distr/impl#[f16][Weight]checked_add_assign().(&mut self, v: &Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[f16][Weight]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ()> { |
| 32 |
// Floats have an explicit representation for overflow |
| 33 |
*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self rust-analyzer cargo half 2.7.1 binary16/impl#[f16][`AddAssign<&f16>`]add_assign().+=rust-analyzer cargo half 2.7.1 binary16/impl#[f16][`AddAssign<&f16>`]add_assign(). rust-analyzer cargo half 2.7.1 binary16/impl#[f16][`AddAssign<&f16>`]add_assign().v; |
| 34 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
impl randrust-analyzer cargo rand 0.10.2 crate/::distrrust-analyzer cargo rand 0.10.2 distr/::weightedrust-analyzer cargo rand 0.10.2 distr/weighted/::Weightrust-analyzer cargo rand 0.10.2 distr/weighted/Weight# for bf16rust-analyzer cargo half 2.7.1 bfloat/bf16# { |
| 39 |
const ZEROrust-analyzer cargo half 2.7.1 rand_distr/impl#[bf16][Weight]ZERO.: Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[bf16][Weight] = Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[bf16][Weight]::ZEROrust-analyzer cargo half 2.7.1 bfloat/impl#[bf16]ZERO.; |
| 40 |
|
| 41 |
fn checked_add_assignrust-analyzer cargo half 2.7.1 rand_distr/impl#[bf16][Weight]checked_add_assign().(&mut self, v: &Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[bf16][Weight]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ()> { |
| 42 |
// Floats have an explicit representation for overflow |
| 43 |
*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self rust-analyzer cargo half 2.7.1 bfloat/impl#[bf16][`AddAssign<&bf16>`]add_assign().+=rust-analyzer cargo half 2.7.1 bfloat/impl#[bf16][`AddAssign<&bf16>`]add_assign(). rust-analyzer cargo half 2.7.1 bfloat/impl#[bf16][`AddAssign<&bf16>`]add_assign().v; |
| 44 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)] |
| 49 |
pub struct Float16Samplerrust-analyzer cargo half 2.7.1 rand_distr/Float16Sampler#(UniformFloatrust-analyzer cargo rand 0.10.2 distr/uniform/float/UniformFloat#<f32>); |
| 50 |
|
| 51 |
impl rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::SampleUniformrust-analyzer cargo rand 0.10.2 distr/uniform/SampleUniform# for f16rust-analyzer cargo half 2.7.1 binary16/f16# { |
| 52 |
type Samplerrust-analyzer cargo half 2.7.1 rand_distr/impl#[f16][SampleUniform]Sampler# = Float16Samplerrust-analyzer cargo half 2.7.1 rand_distr/Float16Sampler#; |
| 53 |
} |
| 54 |
|
| 55 |
impl rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::UniformSamplerrust-analyzer cargo rand 0.10.2 distr/uniform/UniformSampler# for Float16Samplerrust-analyzer cargo half 2.7.1 rand_distr/Float16Sampler# { |
| 56 |
type Xrust-analyzer cargo half 2.7.1 rand_distr/impl#[Float16Sampler][UniformSampler]X# = f16rust-analyzer cargo half 2.7.1 binary16/f16#; |
| 57 |
fn newrust-analyzer cargo half 2.7.1 rand_distr/impl#[Float16Sampler][UniformSampler]new().<B1, B2>(low: B1, high: B2) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[Float16Sampler][UniformSampler], rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::Errorrust-analyzer cargo rand 0.10.2 distr/uniform/Error#> |
| 58 |
where |
| 59 |
B1: rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::SampleBorrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#<Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[Float16Sampler][UniformSampler]::Xrust-analyzer cargo rand 0.10.2 distr/uniform/UniformSampler#X#> + Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 60 |
B2: rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::SampleBorrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#<Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[Float16Sampler][UniformSampler]::Xrust-analyzer cargo rand 0.10.2 distr/uniform/UniformSampler#X#> + Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 61 |
{ |
| 62 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[Float16Sampler][UniformSampler](UniformFloatrust-analyzer cargo rand 0.10.2 distr/uniform/float/UniformFloat#::newrust-analyzer cargo rand 0.10.2 distr/uniform/float/impl#[`UniformFloat<f32>`][UniformSampler]new().( |
| 63 |
low.borrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#borrow().().to_f32rust-analyzer cargo half 2.7.1 binary16/impl#[f16]to_f32().(), |
| 64 |
high.borrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#borrow().().to_f32rust-analyzer cargo half 2.7.1 binary16/impl#[f16]to_f32().(), |
| 65 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)) |
| 66 |
} |
| 67 |
fn new_inclusiverust-analyzer cargo half 2.7.1 rand_distr/impl#[Float16Sampler][UniformSampler]new_inclusive().<B1, B2>(low: B1, high: B2) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[Float16Sampler][UniformSampler], rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::Errorrust-analyzer cargo rand 0.10.2 distr/uniform/Error#> |
| 68 |
where |
| 69 |
B1: rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::SampleBorrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#<Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[Float16Sampler][UniformSampler]::Xrust-analyzer cargo rand 0.10.2 distr/uniform/UniformSampler#X#> + Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 70 |
B2: rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::SampleBorrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#<Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[Float16Sampler][UniformSampler]::Xrust-analyzer cargo rand 0.10.2 distr/uniform/UniformSampler#X#> + Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 71 |
{ |
| 72 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[Float16Sampler][UniformSampler](UniformFloatrust-analyzer cargo rand 0.10.2 distr/uniform/float/UniformFloat#::new_inclusiverust-analyzer cargo rand 0.10.2 distr/uniform/float/impl#[`UniformFloat<f32>`][UniformSampler]new_inclusive().( |
| 73 |
low.borrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#borrow().().to_f32rust-analyzer cargo half 2.7.1 binary16/impl#[f16]to_f32().(), |
| 74 |
high.borrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#borrow().().to_f32rust-analyzer cargo half 2.7.1 binary16/impl#[f16]to_f32().(), |
| 75 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)) |
| 76 |
} |
| •77 |
fn samplerust-analyzer cargo half 2.7.1 rand_distr/impl#[Float16Sampler][UniformSampler]sample().<R: RngExtrust-analyzer cargo rand 0.10.2 rng/RngExt# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>(&self, rng: &mut R) -> Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[Float16Sampler][UniformSampler]::Xrust-analyzer cargo rand 0.10.2 distr/uniform/UniformSampler#X# { |
| 78 |
f16rust-analyzer cargo half 2.7.1 binary16/f16#::from_f32rust-analyzer cargo half 2.7.1 binary16/impl#[f16]from_f32().(self.0rust-analyzer cargo half 2.7.1 rand_distr/Float16Sampler#0..samplerust-analyzer cargo rand 0.10.2 distr/uniform/float/impl#[`UniformFloat<f32>`][UniformSampler]sample().(rng)) |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)] |
| 83 |
pub struct BFloat16Samplerrust-analyzer cargo half 2.7.1 rand_distr/BFloat16Sampler#(UniformFloatrust-analyzer cargo rand 0.10.2 distr/uniform/float/UniformFloat#<f32>); |
| 84 |
|
| 85 |
impl rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::SampleUniformrust-analyzer cargo rand 0.10.2 distr/uniform/SampleUniform# for bf16rust-analyzer cargo half 2.7.1 bfloat/bf16# { |
| 86 |
type Samplerrust-analyzer cargo half 2.7.1 rand_distr/impl#[bf16][SampleUniform]Sampler# = BFloat16Samplerrust-analyzer cargo half 2.7.1 rand_distr/BFloat16Sampler#; |
| 87 |
} |
| 88 |
|
| 89 |
impl rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::UniformSamplerrust-analyzer cargo rand 0.10.2 distr/uniform/UniformSampler# for BFloat16Samplerrust-analyzer cargo half 2.7.1 rand_distr/BFloat16Sampler# { |
| 90 |
type Xrust-analyzer cargo half 2.7.1 rand_distr/impl#[BFloat16Sampler][UniformSampler]X# = bf16rust-analyzer cargo half 2.7.1 bfloat/bf16#; |
| 91 |
fn newrust-analyzer cargo half 2.7.1 rand_distr/impl#[BFloat16Sampler][UniformSampler]new().<B1, B2>(low: B1, high: B2) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[BFloat16Sampler][UniformSampler], rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::Errorrust-analyzer cargo rand 0.10.2 distr/uniform/Error#> |
| 92 |
where |
| 93 |
B1: rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::SampleBorrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#<Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[BFloat16Sampler][UniformSampler]::Xrust-analyzer cargo rand 0.10.2 distr/uniform/UniformSampler#X#> + Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 94 |
B2: rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::SampleBorrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#<Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[BFloat16Sampler][UniformSampler]::Xrust-analyzer cargo rand 0.10.2 distr/uniform/UniformSampler#X#> + Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 95 |
{ |
| 96 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[BFloat16Sampler][UniformSampler](UniformFloatrust-analyzer cargo rand 0.10.2 distr/uniform/float/UniformFloat#::newrust-analyzer cargo rand 0.10.2 distr/uniform/float/impl#[`UniformFloat<f32>`][UniformSampler]new().( |
| 97 |
low.borrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#borrow().().to_f32rust-analyzer cargo half 2.7.1 bfloat/impl#[bf16]to_f32().(), |
| 98 |
high.borrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#borrow().().to_f32rust-analyzer cargo half 2.7.1 bfloat/impl#[bf16]to_f32().(), |
| 99 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)) |
| 100 |
} |
| 101 |
fn new_inclusiverust-analyzer cargo half 2.7.1 rand_distr/impl#[BFloat16Sampler][UniformSampler]new_inclusive().<B1, B2>(low: B1, high: B2) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[BFloat16Sampler][UniformSampler], rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::Errorrust-analyzer cargo rand 0.10.2 distr/uniform/Error#> |
| 102 |
where |
| 103 |
B1: rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::SampleBorrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#<Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[BFloat16Sampler][UniformSampler]::Xrust-analyzer cargo rand 0.10.2 distr/uniform/UniformSampler#X#> + Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 104 |
B2: rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::uniformrust-analyzer cargo rand 0.10.2 distr/uniform/::SampleBorrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#<Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[BFloat16Sampler][UniformSampler]::Xrust-analyzer cargo rand 0.10.2 distr/uniform/UniformSampler#X#> + Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 105 |
{ |
| 106 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[BFloat16Sampler][UniformSampler](UniformFloatrust-analyzer cargo rand 0.10.2 distr/uniform/float/UniformFloat#::new_inclusiverust-analyzer cargo rand 0.10.2 distr/uniform/float/impl#[`UniformFloat<f32>`][UniformSampler]new_inclusive().( |
| 107 |
low.borrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#borrow().().to_f32rust-analyzer cargo half 2.7.1 bfloat/impl#[bf16]to_f32().(), |
| 108 |
high.borrowrust-analyzer cargo rand 0.10.2 distr/uniform/SampleBorrow#borrow().().to_f32rust-analyzer cargo half 2.7.1 bfloat/impl#[bf16]to_f32().(), |
| 109 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)) |
| 110 |
} |
| •111 |
fn samplerust-analyzer cargo half 2.7.1 rand_distr/impl#[BFloat16Sampler][UniformSampler]sample().<R: RngExtrust-analyzer cargo rand 0.10.2 rng/RngExt# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>(&self, rng: &mut R) -> Selfrust-analyzer cargo half 2.7.1 rand_distr/impl#[BFloat16Sampler][UniformSampler]::Xrust-analyzer cargo rand 0.10.2 distr/uniform/UniformSampler#X# { |
| 112 |
bf16rust-analyzer cargo half 2.7.1 bfloat/bf16#::from_f32rust-analyzer cargo half 2.7.1 bfloat/impl#[bf16]from_f32().(self.0rust-analyzer cargo half 2.7.1 rand_distr/BFloat16Sampler#0..samplerust-analyzer cargo rand 0.10.2 distr/uniform/float/impl#[`UniformFloat<f32>`][UniformSampler]sample().(rng)) |
| 113 |
} |
| 114 |
} |
| 115 |
|
| 116 |
#[cfg(test)] |
| 117 |
mod testsrust-analyzer cargo half 2.7.1 rand_distr/tests/ { |
| 118 |
use superrust-analyzer cargo half 2.7.1 rand_distr/::*; |
| 119 |
|
| 120 |
#[allow(unused_imports)] |
| •121 |
use randrust-analyzer cargo rand 0.10.2 crate/::{rngrust-analyzer cargo rand 0.10.2 rng/, RngExtrust-analyzer cargo rand 0.10.2 rng/RngExt#}; |
| 122 |
use rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::{StandardNormalrust-analyzer cargo rand_distr 0.6.0 normal/StandardNormal#, StandardUniformrust-analyzer cargo rand 0.10.2 distr/StandardUniform#, Uniformrust-analyzer cargo rand 0.10.2 distr/uniform/Uniform#}; |
| 123 |
|
| 124 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 125 |
fn test_sample_f16rust-analyzer cargo half 2.7.1 rand_distr/tests/test_sample_f16().() { |
| 126 |
let mut rng = rngrust-analyzer cargo rand 0.10.2 rngs/thread/rng().(); |
| 127 |
let _: f16rust-analyzer cargo half 2.7.1 binary16/f16# = rng.samplerust-analyzer cargo rand 0.10.2 rng/RngExt#sample().(StandardUniformrust-analyzer cargo rand 0.10.2 distr/StandardUniform#); |
| 128 |
let _: f16rust-analyzer cargo half 2.7.1 binary16/f16# = rng.samplerust-analyzer cargo rand 0.10.2 rng/RngExt#sample().(StandardNormalrust-analyzer cargo rand_distr 0.6.0 normal/StandardNormal#); |
| 129 |
let _: f16rust-analyzer cargo half 2.7.1 binary16/f16# = rng.samplerust-analyzer cargo rand 0.10.2 rng/RngExt#sample().(Uniformrust-analyzer cargo rand 0.10.2 distr/uniform/Uniform#::newrust-analyzer cargo rand 0.10.2 distr/uniform/impl#[`Uniform<X>`]new().(f16rust-analyzer cargo half 2.7.1 binary16/f16#::from_f32rust-analyzer cargo half 2.7.1 binary16/impl#[f16]from_f32().(0.0), f16rust-analyzer cargo half 2.7.1 binary16/f16#::from_f32rust-analyzer cargo half 2.7.1 binary16/impl#[f16]from_f32().(1.0)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 130 |
#[cfg(feature = "num-traits")] |
| 131 |
let _: f16rust-analyzer cargo half 2.7.1 binary16/f16# = |
| 132 |
rng.samplerust-analyzer cargo rand 0.10.2 rng/RngExt#sample().(rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::Normalrust-analyzer cargo rand_distr 0.6.0 normal/Normal#::newrust-analyzer cargo rand_distr 0.6.0 normal/impl#[`Normal<F>`]new().(f16rust-analyzer cargo half 2.7.1 binary16/f16#::from_f32rust-analyzer cargo half 2.7.1 binary16/impl#[f16]from_f32().(0.0), f16rust-analyzer cargo half 2.7.1 binary16/f16#::from_f32rust-analyzer cargo half 2.7.1 binary16/impl#[f16]from_f32().(1.0)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 133 |
} |
| 134 |
|
| 135 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 136 |
fn test_sample_bf16rust-analyzer cargo half 2.7.1 rand_distr/tests/test_sample_bf16().() { |
| 137 |
let mut rng = rngrust-analyzer cargo rand 0.10.2 rngs/thread/rng().(); |
| 138 |
let _: bf16rust-analyzer cargo half 2.7.1 bfloat/bf16# = rng.samplerust-analyzer cargo rand 0.10.2 rng/RngExt#sample().(StandardUniformrust-analyzer cargo rand 0.10.2 distr/StandardUniform#); |
| 139 |
let _: bf16rust-analyzer cargo half 2.7.1 bfloat/bf16# = rng.samplerust-analyzer cargo rand 0.10.2 rng/RngExt#sample().(StandardNormalrust-analyzer cargo rand_distr 0.6.0 normal/StandardNormal#); |
| 140 |
let _: bf16rust-analyzer cargo half 2.7.1 bfloat/bf16# = rng.samplerust-analyzer cargo rand 0.10.2 rng/RngExt#sample().(Uniformrust-analyzer cargo rand 0.10.2 distr/uniform/Uniform#::newrust-analyzer cargo rand 0.10.2 distr/uniform/impl#[`Uniform<X>`]new().(bf16rust-analyzer cargo half 2.7.1 bfloat/bf16#::from_f32rust-analyzer cargo half 2.7.1 bfloat/impl#[bf16]from_f32().(0.0), bf16rust-analyzer cargo half 2.7.1 bfloat/bf16#::from_f32rust-analyzer cargo half 2.7.1 bfloat/impl#[bf16]from_f32().(1.0)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 141 |
#[cfg(feature = "num-traits")] |
| 142 |
let _: bf16rust-analyzer cargo half 2.7.1 bfloat/bf16# = |
| 143 |
rng.samplerust-analyzer cargo rand 0.10.2 rng/RngExt#sample().(rand_distrrust-analyzer cargo rand_distr 0.6.0 crate/::Normalrust-analyzer cargo rand_distr 0.6.0 normal/Normal#::newrust-analyzer cargo rand_distr 0.6.0 normal/impl#[`Normal<F>`]new().(bf16rust-analyzer cargo half 2.7.1 bfloat/bf16#::from_f32rust-analyzer cargo half 2.7.1 bfloat/impl#[bf16]from_f32().(0.0), bf16rust-analyzer cargo half 2.7.1 bfloat/bf16#::from_f32rust-analyzer cargo half 2.7.1 bfloat/impl#[bf16]from_f32().(1.0)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 144 |
} |
| 145 |
} |