Replaced rand freebsdlib's rand and added syscall from gbl08ma's fork