You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This casts the result of get_time_second() to long before the x1000 operation, so the millisecond component is lost before the multiplication, resulting in the seeds always having 000 as the final 3 digits. I don't believe this is the intended behaviour because it should use the 3-digit millisecond component in the generated seed.
Putting additional parenthesis around the calculation to delay the cast to long to the end seems to fix the problem:
long millis = (long) (get_time_second() * 1000);
I have provided example executions below, run on Ubuntu 20.04.
Original output:
gettimeofday ran with tv_sec: 1668419612, tv_usec: 610524
Generated random root seed 419612000. millis: 1668419612000, range: 1000000000
After fix:
gettimeofday ran with tv_sec: 1668419694, tv_usec: 729435
Generated random root seed 419694729. millis: 1668419694729, range: 1000000000
Cheers!
Ricardo
The text was updated successfully, but these errors were encountered:
Hi,
Thanks for the great repo!
I think I have found a possible bug with generating the pseudo-random random root seed:
despot/src/plannerbase.cpp
Line 264 in 37a3e21
This casts the result of
get_time_second()
to long before the x1000 operation, so the millisecond component is lost before the multiplication, resulting in the seeds always having 000 as the final 3 digits. I don't believe this is the intended behaviour because it should use the 3-digit millisecond component in the generated seed.Putting additional parenthesis around the calculation to delay the cast to long to the end seems to fix the problem:
I have provided example executions below, run on Ubuntu 20.04.
Original output:
After fix:
Cheers!
Ricardo
The text was updated successfully, but these errors were encountered: