Fix build errors for WIN32

* Use time() to init srand()

getpid() isn't available on msvc, and istead of
making a wrapper we can just as well use time()

Use C89 style

Change-Id: Id139ec563227eddaeb34ea6d39b15e061fbdbe15