%PDF- %PDF-
Direktori : /lib/python3/dist-packages/pythran/pythonic/random/ |
Current File : //lib/python3/dist-packages/pythran/pythonic/random/randrange.hpp |
#ifndef PYTHONIC_RANDOM_RANDRANGE_HPP #define PYTHONIC_RANDOM_RANDRANGE_HPP #include "pythonic/include/random/randrange.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/random/random.hpp" #include <cmath> PYTHONIC_NS_BEGIN namespace random { long randrange(long stop) { return long(random() * stop); } long randrange(long start, long stop) { return start + long(random() * (stop - start)); } long randrange(long start, long stop, long step) { return start + step * long((random() * (stop - start)) / std::abs(step)); } } PYTHONIC_NS_END #endif