Mercurial > repos > chrisd > testing
view gene_fraction/src/int_util.h @ 0:f95150c37d38 draft default tip
planemo upload for repository https://github.com/ChrisD11/Tools commit ddc95e5d6b5f2c0a5340c0bc384aa822db8856d5
author | chrisd |
---|---|
date | Sun, 21 Feb 2016 23:31:55 -0500 |
parents | |
children |
line wrap: on
line source
#ifndef INT_UTIL_H #define INT_UTIL_H #include <string> #include <sstream> /** * Given a string, return its integer. */ static inline int s_to_i(const std::string &s) { std::istringstream ss(s); int i; ss >> i; return i; } /** * Given an integer, return a random number * between 0 and i. */ static inline int randomize(const int &i) { return rand() % i; } #endif /*INT_UTIL_H */