\returns a random point inside the bounding box sampled with * a uniform distribution */
| 200 | /** \returns a random point inside the bounding box sampled with |
| 201 | * a uniform distribution */ |
| 202 | EIGEN_DEVICE_FUNC inline VectorType sample() const |
| 203 | { |
| 204 | VectorType r(dim()); |
| 205 | for(Index d=0; d<dim(); ++d) |
| 206 | { |
| 207 | if(!ScalarTraits::IsInteger) |
| 208 | { |
| 209 | r[d] = m_min[d] + (m_max[d]-m_min[d]) |
| 210 | * internal::random<Scalar>(Scalar(0), Scalar(1)); |
| 211 | } |
| 212 | else |
| 213 | r[d] = internal::random(m_min[d], m_max[d]); |
| 214 | } |
| 215 | return r; |
| 216 | } |
| 217 | |
| 218 | /** \returns true if the point \a p is inside the box \c *this. */ |
| 219 | template<typename Derived> |