Controlling rand bit in a base class

There is a rand bit which should be considered value 1’b0 for ‘y’ number of tests and value 1’b1 for only one test. How to control this bit from the base class where all the test sequences are extended from this base class.

You probably need to explain in a little more detail to get a better answer. It does not sound like this bit is random at all, so do not declare it as rand. Just declare it as a simple bit in the base class, and in one of your extended classes, set the bit to 1’b1 in that one test in its constructor.

Or you could mean that you want to randomly pick one test for the bit to be one. That is going to be more difficult. You could set a dist constraint { 0 := y-1, 1 := 1 } and check it with a functional covergroup to make sure the the bit was set at least once.

If the bit can only be set in only 1 out of y tests, that seems like a strange requirement. You will have to control that in an external script that runs the tests.