EGong

git clone git://xatko.vsos.ethz.ch/EGong.git
Log | Files | Refs

Misc.c (443B)


      1 #include <EGong/Util/Misc.h>
      2 #include <EGong/Util/Log.h>
      3 #include <stdlib.h>
      4 #include <time.h>
      5 
      6 void EGong_misc_rand_init(void){
      7 	srand(time(NULL));
      8 }
      9 int EGong_misc_get_rand(char *dest, int length){
     10 	const static size_t blocksize=sizeof(int)/sizeof(*dest);
     11 	for(;length>0;length-=blocksize){
     12 		if(length<blocksize){
     13 			dest-=blocksize-length;
     14 		}
     15 		*(int*)dest=rand();
     16 		dest+=blocksize;
     17 	}
     18 	return 0;
     19 }
     20 
     21 int EGong_array_init(){
     22 	return 0;
     23 }