Register  |  FAQ  |  Search  |  Memberlist  |  Usergroups  |  Log in 
Reply to topic
 os.time() 
hde


Joined: 08 Oct 2007
Posts: 46
Reply with quote
During play with the Winds3D Player i have detected that you get with os.time() (test ist with "print(os.time())" in the console) already the same value. Normally this value change because auf time. Need it for generating seed for the random function. Vincent, could you please check ? Thx
View user's profile Send private message
  
Vincent


Joined: 25 Dec 2006
Posts: 296
Reply with quote
Thanks for your report! I think I have found the reason:

The return value of os.time() is a big integer, and Winds3D Player's LUA interpreter use single-precision floating-point to represents numbers; because the precision problem, a single-precision floating-point number can not accurately express such a big integer. In fact, if you print(os.time()) at intervals of several minutes, you'll get different return values.

If just for generating random seed, maybe you can use os.clock() replaced.
View user's profile Send private message
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic