lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> 在 2018年4月13日,下午11:35,Albert Chan <albertmcchan@yahoo.com> 写道:
> 
> 
> Prior to lua 5.4, lua math.random() use  C rand().
> rand() does not know about lua upvalues.
> 
> 

CRT is thread-safe, but using a C static variable isn’t.

When we run multi-states in multi-thread, calling math.rand() at the same time, the random sequence may rewind .