Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/util/funcs.h b/util/funcs.h
index 869a1fb1..8d87be19 100644
--- a/util/funcs.h
+++ b/util/funcs.h
@@ -1,57 +1,63 @@
#ifndef _funcs_h
#define _funcs_h
#include <stdlib.h>
#include <vector>
#include <string>
#include "regex.h"
namespace Util{
extern const double pi;
-// int rnd( int q );
+
+/* returns a number between 0 and q-1. you will never get `q'. if
+ * you wanted to get `q' then pass in q+1
+ */
inline int rnd( int q ){
- if ( q <= 0 ) return 0;
- return (int)( rand() % q );
+ if (q <= 0){
+ return 0;
+ }
+
+ return (int)(rand() % q);
}
std::vector< std::string > getFiles( const std::string & dataPath, const std::string & find );
double radians(double degree);
std::string getDataPath2();
void setDataPath( const std::string & str );
bool exists( const std::string & file );
/* check that `version' is compatible with this program, mostly used
* for network clients.
*/
bool checkVersion(int version);
/* return a random number + some range between min/max */
int rnd( int q, int min, int max );
int max(int a, int b);
int min(int a, int b);
/* return a number between min/max */
int rnd( int min, int max );
void blend_palette( int * pal, int mp, int sc, int ec );
void rest( int x );
std::string trim(const std::string & str);
std::string upcase(std::string str);
int levenshtein(const std::string & str1, const std::string & str2);
int getPipe(int files[2]);
}
#endif

File Metadata

Mime Type
text/x-diff
Expires
Thu, Jun 11, 1:25 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
69237
Default Alt Text
(1 KB)

Event Timeline