Warning, /frameworks/syntax-highlighting/autotests/input/std_b00001.vtc is written in an unsupported language. File is not indexed.

0001 varnishtest "Test std.random()"
0002 
0003 server s1 {
0004         rxreq
0005         txresp
0006 } -start
0007 
0008 varnish v1 -vcl+backend {
0009         import std;
0010 
0011         sub vcl_deliver {
0012                 set resp.http.rnd1 = std.random(0, 1);
0013                 set resp.http.rnd2 = std.random(0, 10);
0014                 set resp.http.rnd3 = std.random(8, 10);
0015                 set resp.http.rnd4 = std.random(99, 100);
0016         }
0017 } -start
0018 
0019 varnish v1 -cliok "debug.srandom"
0020 
0021 client c1 {
0022         txreq
0023         rxresp
0024         expect resp.http.rnd1 == 0.656
0025         expect resp.http.rnd2 == 0.390
0026         expect resp.http.rnd3 == 8.585
0027         expect resp.http.rnd4 == 99.636
0028 } -run