Constraints for a random variable in uvm test cases

Hi I am writing uvm test cases as part of my project.
My question is
Can we write Constraints for a variable declared as “rand” in uvm test cases?
I haven’t use constraints in test cases before.
Please reply.

Regards,
Srikanth

In reply to srikanth.verification:
In the test you are selecting one or more sequences for execution. The dedicated sequences should have the constraints you need.

In reply to srikanth.verification:

Yes you can,
but as per your provided details, do you want to randomized certain fields and want to execute your test sequences based on that randomization results?
Provide your exact requirement.

Since run_test() doesn’t randomize the test, you need to explicitly randomize the variable or the randomize entire test. As in:


if(!randomize(m_variable_handle))
  `uvm_fatal(get_full_name(), "randomization failed")