]> git.localhorst.tv Git - blank.git/blobdiff - src/rand/GaloisLFSR.hpp
fix assert inclusion in rand
[blank.git] / src / rand / GaloisLFSR.hpp
index 81652d85f54a64cd628c22a95d3493b6de6476cd..f8a61e23f3f7c721689d7e0ff4a2404aa671f412 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef BLANK_RAND_GALOISLFSR_HPP_
 #define BLANK_RAND_GALOISLFSR_HPP_
 
+#include <cassert>
 #include <cstdint>
 #include <limits>
 
@@ -63,10 +64,12 @@ public:
 
        template<class Container>
        typename Container::reference From(Container &c) {
+               assert(c.size() > 0);
                return c[Next<typename Container::size_type>() % c.size()];
        }
        template<class Container>
        typename Container::const_reference From(const Container &c) {
+               assert(c.size() > 0);
                return c[Next<typename Container::size_type>() % c.size()];
        }