Fixes to run rand example

Hi guys,
I just pull the latest version and tried running the examples. 
I ran into 3 separate issues before I could get the example to run. Not sure if I was doing something wrong, but here are the changes I made.
Cheers,
James