Hi, guys! I’m new with P4 and I have lots of doubts but for now my question is how to implement (if it is possible) this code/idea:

I want to reduce my code to generate random values and set them into a register like that:

```
register<bit<32>>(16) register_pub_matrix;
.
.
.
#define gen_matrix(INDEX) action gen_matrix_r##INDEX##() {
bit<32> coef;
random(coef, 0, PARAM_Q);
register_pub_matrix.write(##INDEX##, coef);
}
gen_matrix(0)
gen_matrix(1)
gen_matrix(2)
gen_matrix(3)
gen_matrix(4)
gen_matrix(5)
gen_matrix(6)
gen_matrix(7)
gen_matrix(8)
gen_matrix(9)
gen_matrix(10)
gen_matrix(11)
gen_matrix(12)
gen_matrix(13)
gen_matrix(14)
gen_matrix(15)
```

However, I got this error message:

syntax error, unexpected IDENTIFIER, expecting ACTION or CONST or TABLE

random

^^^^^^^

If I understood correctly, I can only use a constant here, not call methods, externs, etc…

Is there any way to implement this without copy and paste multiple times the random call?

Thanks in advance!