Skip to content

Commit

Permalink
FIX: not truncating random time to seconds only
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed May 4, 2021
1 parent a264a69 commit e868dba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/t-time.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@
Set_Random(secs);
return R_UNSET;
}
secs = Random_Range(secs / SEC_SEC, D_REF(3)) * SEC_SEC;
secs = Random_Range(secs, D_REF(3));
goto fixTime;

case A_PICK:
Expand Down
13 changes: 13 additions & 0 deletions src/tests/units/time-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,19 @@ Rebol [

===end-group===

===start-group=== "random"
--test-- "random time!"
;@@ https://github.com/Oldes/Rebol-issues/issues/911
t: random 0:0:0.10
--assert all [t > 0:0 t < 0:0:0.10]
t: random 1:0:0
--assert all [t > 0:0 t < 1:0:0]


===end-group===



;===start-group=== "time protect"
; ;@@ https://github.com/Oldes/Rebol-issues/issues/2416
; --test-- "time protect 1"
Expand Down

0 comments on commit e868dba

Please sign in to comment.