mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 12:31:51 +00:00
randomTick sped up with faster rand implementation
This commit is contained in:
parent
d7f2771da4
commit
6214e1a507
2 changed files with 26 additions and 7 deletions
17
src/maths/fastmaths.h
Normal file
17
src/maths/fastmaths.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef MATHS_FASTMATHS_H_
|
||||
#define MATHS_FASTMATHS_H_
|
||||
|
||||
namespace fastmaths {
|
||||
static unsigned int g_seed;
|
||||
|
||||
inline void srand(int seed) {
|
||||
g_seed = seed;
|
||||
}
|
||||
|
||||
inline int rand(void) {
|
||||
g_seed = (214013*g_seed+2531011);
|
||||
return (g_seed>>16)&0x7FFF;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MATHS_FASTMATHS_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue