Fix Makefile for windows (mingw gcc is picker with linking)
Fix Random for lack of rand_r on some platforms.