source: abuse/branches/pd/macabuse/imlib/include/jrand.hpp @ 636

Last change on this file since 636 was 49, checked in by Sam Hocevar, 15 years ago
  • Imported original public domain release, for future reference.
File size: 371 bytes
Line 
1#ifndef __JRAND_HPP_
2#define __JRAND_HPP_
3
4#define RAND_TABLE_SIZE 1024
5extern unsigned short rtable[RAND_TABLE_SIZE];     // can be used directly when
6extern unsigned short rand_on;                     // speed is of essence
7
8void jrand_init();
9inline unsigned short jrand() { return rtable[(rand_on++)&(RAND_TABLE_SIZE-1)]; }
10#define jrandom(x) (jrand()%(x))
11
12#endif
13
Note: See TracBrowser for help on using the repository browser.