utils.h 378 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef __utils_h__
  2. #define __utils_h__
  3. #include "defs.h"
  4. static inline char* strtolower(char* s) {
  5. for(char* x = s; *x; x++) *x = tolower(*x);
  6. return s;
  7. }
  8. static inline double nrand() {
  9. return (double)rand() / (double)RAND_MAX;
  10. }
  11. int word_exists_in_sentence_prior_to(sentence_info* s, int index);
  12. void sort_words(int* words, int len);
  13. #endif // __utils_h__