Use system RNG in tests.

This commit is contained in:
CismonX 2021-01-21 03:42:21 +08:00
parent b9bb1dcdbe
commit f6d0fa4cd0
Signed by: cismonx
GPG Key ID: 3094873E29A482FB
2 changed files with 12 additions and 7 deletions

View File

@ -9,9 +9,9 @@
set tool ctlseqs set tool ctlseqs
set timeout 2 set timeout 2
set n1 [ expr int(rand()*5000) ] set n1 [ random_int ]
set n2 [ expr int(rand()*5000) ] set n2 [ random_int ]
set n3 [ expr int(rand()*5000) ] set n3 [ random_int ]
set input { } set input { }
lappend input "$CSI$n1;${n2}H" lappend input "$CSI$n1;${n2}H"

View File

@ -6,6 +6,11 @@
# this notice are preserved. This file is offered as-is, without any warranty. # this notice are preserved. This file is offered as-is, without any warranty.
# #
set ESC "\x1b"
set CSI "$ESC\["
set DCS "${ESC}P"
set ST "$ESC\\"
proc tcsgrep_start args { proc tcsgrep_start args {
global TCSGREP_BIN global TCSGREP_BIN
set run_cmd [ list $TCSGREP_BIN "-t500" ] set run_cmd [ list $TCSGREP_BIN "-t500" ]
@ -38,7 +43,7 @@ proc tcsgrep_stop { } {
} }
} }
set ESC "\x1b" proc random_int { } {
set CSI "$ESC\[" set num [ exec od -An -td -N4 /dev/urandom ]
set DCS "${ESC}P" return [ expr abs(int($num)) ]
set ST "$ESC\\" }