From 7b0554f4c972d618e3bc38ab254237ae0d1e680f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Concei=C3=A7=C3=A3o?= Date: Tue, 10 Oct 2023 11:21:04 +0100 Subject: [PATCH] fix train.ua random bounds --- 91_Train/lua/train.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/91_Train/lua/train.lua b/91_Train/lua/train.lua index dde7cd4d2..50214fa90 100644 --- a/91_Train/lua/train.lua +++ b/91_Train/lua/train.lua @@ -11,9 +11,9 @@ math.randomseed(os.time()) local ERROR_MARGIN = 5.0 function play() - local car_speed = math.random(40, 65) --Between 40 and 64 - local delta_time = math.random(5, 20) --Between 5 and 19 - local train_speed = math.random(20, 39) --Between 20 and 38 + local car_speed = 25*math.random() + 40--Between 40 and 64 + local delta_time = 15*math.random() + 5--Between 5 and 19 + local train_speed = 19*math.random() + 20--Between 20 and 38 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) )