Skip to content

Commit 7b0554f

Browse files
committed
fix train.ua random bounds
1 parent 2aa6776 commit 7b0554f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

91_Train/lua/train.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ math.randomseed(os.time())
1111
local ERROR_MARGIN <const> = 5.0
1212

1313
function play()
14-
local car_speed = math.random(40, 65) --Between 40 and 64
15-
local delta_time = math.random(5, 20) --Between 5 and 19
16-
local train_speed = math.random(20, 39) --Between 20 and 38
14+
local car_speed = 25*math.random() + 40--Between 40 and 64
15+
local delta_time = 15*math.random() + 5--Between 5 and 19
16+
local train_speed = 19*math.random() + 20--Between 20 and 38
1717

1818
print( string.format("\nA CAR TRAVELING AT %u MPH CAN MAKE A CERTAIN TRIP IN %u HOURS LESS THAN A TRAIN TRAVELING AT %u MPH.", car_speed, delta_time, train_speed) )
1919

0 commit comments

Comments
 (0)