comparison gene_fraction/src/int_util.h @ 0:0fd352f62446 draft default tip

planemo upload for repository https://github.com/ChrisD11/Duplicon commit 3ee0594c692faac542ffa58f4339d79b9b8aefbd-dirty
author chrisd
date Sun, 21 Feb 2016 06:05:24 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0fd352f62446
1 #ifndef INT_UTIL_H
2 #define INT_UTIL_H
3
4 #include <string>
5 #include <sstream>
6
7 /**
8 * Given a string, return its integer.
9 */
10 static inline int
11 s_to_i(const std::string &s) {
12 std::istringstream ss(s);
13 int i;
14 ss >> i;
15 return i;
16 }
17
18 /**
19 * Given an integer, return a random number
20 * between 0 and i.
21 */
22 static inline int
23 randomize(const int &i) {
24 return rand() % i;
25 }
26
27 #endif /*INT_UTIL_H */
28
29