extent: use matching types for random calls
This commit is contained in:
parent
6f440d0bcf
commit
ea8416592a
@ -166,13 +166,17 @@ namespace cruft {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Return a uniform random point that lies within the extent.
|
||||||
|
///
|
||||||
|
/// The interval conventions are the same as for the std library; close for
|
||||||
|
/// integers, half-open for reals.
|
||||||
template <size_t S, typename T, typename GeneratorT>
|
template <size_t S, typename T, typename GeneratorT>
|
||||||
cruft::point<S,T>
|
cruft::point<S,T>
|
||||||
sample (cruft::extent<S,T> shape, GeneratorT &&gen)
|
sample (cruft::extent<S,T> shape, GeneratorT &&gen)
|
||||||
{
|
{
|
||||||
cruft::point<S,T> p;
|
cruft::point<S,T> p;
|
||||||
for (size_t i = 0; i < S; ++i)
|
for (size_t i = 0; i < S; ++i)
|
||||||
p[i] = cruft::random::uniform (0, shape[i], gen);
|
p[i] = cruft::random::uniform (T{0}, shape[i], gen);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user