There is a example contract for consume random, and you can run it follow the steps.
git clone https://github.com/hpb-project/SRNG
cd SRNG
modify runconsume.sh and fill PRIVATE_KEY with your own value
npm install
./runconsume.sh
And you can also modify the code in contracts/example/Consumer.sol
according to your needs