Files
assimp/include/BoostWorkaround/boost/random/uniform_int.hpp
2009-01-12 22:26:11 +00:00

31 lines
496 B
C++

#ifndef BOOST_UNIFORM_INT_INCLUDED
#define BOOST_UNIFORM_INT_INCLUDED
namespace boost
{
template <typename IntType = unsigned int>
class uniform_int
{
public:
typedef IntType type;
uniform_int (IntType _first, IntType _last)
: first (_first)
, last (_last)
{}
IntType operator () (IntType in)
{
return (IntType)((in * ((last-first)/RAND_MAX)) + first);
}
private:
IntType first, last;
};
};
#endif // BOOST_UNIFORM_INT_INCLUDED