utils.h 465 B

12345678910111213141516171819202122
  1. #ifndef UTILS_H
  2. #define UTILS_H
  3. // http://c-faq.com/lib/randrange.html
  4. int randint(int N);
  5. // http://c-faq.com/lib/randrange.html
  6. // numbers in the range [M, N] could be generated with something like
  7. int randrange(int M, int N);
  8. /**
  9. * Display a repr of the given string.
  10. *
  11. * This converts most \n\r\v\f\t codes,
  12. * defaults to \xHH (hex value).
  13. */
  14. char *repr(const char *data);
  15. const char *strnstr(const char *source, int len, const char *needle);
  16. #endif