Forums
missing Rand function/macro - Printable Version

+- Forums (http://www.scratchpadgames.net/forums)
+-- Forum: Main Forums (http://www.scratchpadgames.net/forums/forumdisplay.php?fid=1)
+--- Forum: Fundamentals Errata/Questions (http://www.scratchpadgames.net/forums/forumdisplay.php?fid=3)
+--- Thread: missing Rand function/macro (/showthread.php?tid=168)



missing Rand function/macro - Brian Beuken - 11-19-2018

its not really missing you can find it in the invaders code and copy it over. Many of the files after invaders are starter projects where you have to add functions/macros and methods. But its causing a bit of confusion so I've added it to the Kamikazi base code, and here it is

inline float Rand(float a_Range) { return ((float)rand() / RAND_MAX) * a_Range; }

its a small inline function, I add it to Game.h but its at home in any frequently included header file.