|
Graham Wilson wrote:
int r = rand()%RAND_MAX; lua_pushnumber(L, (lua_Number)r / (lua_Number)RAND_MAX); /* Number between 0 and 1 */
Simple mathematics shows us that this will always push 0. Because: 0 <= r < RAND_MAX and so r/RAND_MAX == 0. AMDG, Antero Vipunen.