Mailing List Archive

Odd one, varnish doesn't recognize symbol for std.rand
Probably a stupid question, but I have at the top of my file:

import std;

But varnish doesn't recognize symbol for std.rand


Aug 25 03:03:35 almstgvarnish124 varnishd[910081]: Message from
VCC-compiler:
Aug 25 03:03:35 almstgvarnish124 varnishd[910081]: Symbol not found:
'std.rand'
Aug 25 03:03:35 almstgvarnish124 varnishd[910081]: At:
('/etc/varnish/default.vcl' Line 94 Pos 17) -- (Pos 24)
Aug 25 03:03:35 almstgvarnish124 varnishd[910081]: if
(std.rand(0, 100) < 50) {
Aug 25 03:03:35 almstgvarnish124 varnishd[910081]:
----------------########----------------

Seems odd... I thought it was included in the 7.3 distribution. How do I
fix that?

---
Re: Odd one, varnish doesn't recognize symbol for std.rand [ In reply to ]
Please use the varnish-misc for that kind of questions (I know it failed
previously, let's try again)

you want `std.random()`, not `std.rand()`:
https://varnish-cache.org/docs/trunk/reference/vmod_std.html#std-random
--
Guillaume Quintard


On Fri, Aug 25, 2023 at 10:14?AM Kari Cowan <kcowan@alm.com> wrote:

> Probably a stupid question, but I have at the top of my file:
>
> import std;
>
> But varnish doesn't recognize symbol for std.rand
>
>
> Aug 25 03:03:35 almstgvarnish124 varnishd[910081]: Message from
> VCC-compiler:
> Aug 25 03:03:35 almstgvarnish124 varnishd[910081]: Symbol not found:
> 'std.rand'
> Aug 25 03:03:35 almstgvarnish124 varnishd[910081]: At:
> ('/etc/varnish/default.vcl' Line 94 Pos 17) -- (Pos 24)
> Aug 25 03:03:35 almstgvarnish124 varnishd[910081]: if
> (std.rand(0, 100) < 50) {
> Aug 25 03:03:35 almstgvarnish124 varnishd[910081]:
> ----------------########----------------
>
> Seems odd... I thought it was included in the 7.3 distribution. How do I
> fix that?
>
> ---
> _______________________________________________
> varnish-dev mailing list
> varnish-dev@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
>