Randc implementation

How to implement randc behaviour without using randc keyword ?

Using $random we can generate random values