Back to index

numactl  2.0.8~rc4
mt.h
Go to the documentation of this file.
00001 #define MT_LEN            624
00002 
00003 extern void mt_init(void);
00004 extern void mt_refill();
00005 
00006 extern int mt_index;
00007 extern unsigned int mt_buffer[MT_LEN];
00008 
00009 static inline unsigned int mt_random(void)
00010 {
00011     unsigned int * b = mt_buffer;
00012     int idx = mt_index;
00013 
00014     if (idx == MT_LEN*sizeof(unsigned int)) {
00015            mt_refill();
00016            idx = 0;
00017     }
00018     mt_index += sizeof(unsigned int);
00019     return *(unsigned int *)((unsigned char *)b + idx);
00020 }