hash.hh (500B)
1 #ifndef _HASH_HH_ 2 #define _HASH_HH_ 3 4 #include "all_includes.hh" 5 6 int random_seed(); 7 8 unsigned int hash2(unsigned int a, unsigned int b); 9 float floatInRange(int seed, int n, float a, float b); // Renvoie le n-ième nombre aléatoire dérivé de seed entre a et b (a inclus, b non inclus). 10 bool proba(int seed, int n, float proba); // Renvoie vrai avec une probabilité de `proba`. 11 typedef union FloatUIntUnion { 12 float f; 13 unsigned int ui; 14 } FloatUIntUnion; 15 unsigned int float2uint(float f); 16 17 #endif