Can randomize with take a return value of a function

Hello,
I need help with randomize function.

I have commands stored in a queue, say
int master_cmdQ[$];…

I have a function in my monitor that pushes commands into master_cmdQ.
Based on the master command I have to size an array in my item (uvm_sequence_item), so will this work

assert(comm_item.randomize() with {comm_item.kind == master_cmdQ.pop_front();})

Thanks

In reply to bramaniinfn:
No. You can only use pure functions in any constraint. A pure function is one whose return value is solely dependent on its arguments and cannot modify any state. This is not the case for pop_front().

You will have to use a temporary variable before calling randomize().