Is there a function to generate a random int number in C? Or will I have to use a third party library?
FWIW, the answer is that yes, there is a stdlib.h
function called rand
; this function is tuned primarily for speed and distribution, not for unpredictability. Almost all built-in random functions for various languages and frameworks use this function by default. There are also "cryptographic" random number generators that are much less predictable, but run much slower. These should be used in any sort of security-related application.