Forgot to include assert.h.
Added a function to generate a random block_index. NOT TESTED.