Most efficient way to randomize payload and length?

As Ben’s example shows, the payload elements are randomized as well as the size of the array. There is no need to use the post_randomize() function.

Here is the relevant LRM section 18.4:

— Arrays can be declared rand or randc, in which case all of their member elements are treated as rand or randc.
— Individual array elements can be constrained, in which case the index expression may include iterative constraint loop variables, constants, and state variables.
— Dynamic arrays, associative arrays and queues can be declared rand or randc. All of the elements in the array are randomized, overwriting any previous data.