Why void casting when randomizing class variables?

In reply to jh_veryveri:

  1. Casting the return value of a function to void explicitly tells the compiler / simulator that you are discarding the value. Some compilers / simulators may throw a warning if it’s not cast to void.

  2. You should always check the return value of randomize, even on “obvious” randomizations that you know can’t fail. A macro can help make things easier.

1 Like