source: abuse/trunk/src/imlib/include/jrand.hpp @ 28

Last change on this file since 28 was 2, checked in by Sam Hocevar, 18 years ago
  • imported original 0.7.0 tarball
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.