NVIDIA interview question

implement a function for randc in Python or system verilog without using any builtin functions