Add some comments about random variates
This commit is contained in:
parent
fd3a752409
commit
c8fe49b1e9
|
@ -691,6 +691,7 @@ impl<N: RealField> Distribution<Orthographic3<N>> for Standard
|
|||
where
|
||||
Standard: Distribution<N>,
|
||||
{
|
||||
/// Generate an arbitrary random variate for testing purposes.
|
||||
fn sample<R: Rng + ?Sized>(&self, r: &mut R) -> Orthographic3<N> {
|
||||
use crate::base::helper;
|
||||
let left = r.gen();
|
||||
|
|
|
@ -275,6 +275,7 @@ impl<N: RealField> Distribution<Perspective3<N>> for Standard
|
|||
where
|
||||
Standard: Distribution<N>,
|
||||
{
|
||||
/// Generate an arbitrary random variate for testing purposes.
|
||||
fn sample<'a, R: Rng + ?Sized>(&self, r: &'a mut R) -> Perspective3<N> {
|
||||
use crate::base::helper;
|
||||
let znear = r.gen();
|
||||
|
|
|
@ -164,6 +164,7 @@ where
|
|||
DefaultAllocator: Allocator<N, D>,
|
||||
Standard: Distribution<N>,
|
||||
{
|
||||
/// Generate a `Point` where each coordinate is an independent variate from `[0, 1)`.
|
||||
#[inline]
|
||||
fn sample<'a, G: Rng + ?Sized>(&self, rng: &mut G) -> Point<N, D> {
|
||||
Point::from(rng.gen::<VectorN<N, D>>())
|
||||
|
|
|
@ -69,6 +69,7 @@ where
|
|||
DefaultAllocator: Allocator<N, D>,
|
||||
Standard: Distribution<N> + Distribution<R>,
|
||||
{
|
||||
/// Generate an arbitrary random variate for testing purposes.
|
||||
#[inline]
|
||||
fn sample<'a, G: Rng + ?Sized>(&self, rng: &mut G) -> Similarity<N, D, R> {
|
||||
let mut s = rng.gen();
|
||||
|
|
|
@ -78,6 +78,7 @@ where
|
|||
DefaultAllocator: Allocator<N, D>,
|
||||
Standard: Distribution<N>,
|
||||
{
|
||||
/// Generate an arbitrary random variate for testing purposes.
|
||||
#[inline]
|
||||
fn sample<'a, G: Rng + ?Sized>(&self, rng: &'a mut G) -> Translation<N, D> {
|
||||
Translation::from(rng.gen::<VectorN<N, D>>())
|
||||
|
|
|
@ -33,6 +33,8 @@ where
|
|||
|
||||
// This is a wrapper similar to RandComplex, but for non-complex.
|
||||
// This exists only to make generic tests easier to write.
|
||||
//
|
||||
// Generates variates in the range [0, 1).
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub struct RandScalar<N>(pub N);
|
||||
|
||||
|
|
Loading…
Reference in New Issue