Update code to compile with latest master. 

The 2 commits update the code so that it compiles with the latest master, though still with a great number of warnings. libextra is no longer used and causes an ICE, random numbers are now in a separate librand library. Indexing using tuples was not compiling so was changed to calls to get.