Trand is a more secure alternative to rand. To compile: gcc your.c -L path_to_libtrand.a -ltrand trand functions vs stdlib rand outputs for consecutives calls with same seed: