random and srandom are non-standard C functions. They are included in glibc on many platforms (linux, BSD etc). However, since they aren't part of the C Standard, they are not required to be available on all compilers.
All standard C compilers however come with rand and srand, so just change your program to call rand instead of random. If other sample programs in your book call srandom, then use srand instead.
Change your program to
#include <stdio.h>
#include <stdlib.h>
int main()
{
int hat;
hat = rand();
printf("%d is a random number.\n",hat);
return(0);
}
The next program in your book probably adds a call to srandom to make the psuedo random numbers generated to be really random. If so, use srand instead.
If a beginner book on C actually uses random and srandom, then it should probably be thrown out. And any book on C which uses random and srandom without telling you that they are non-standard should be thrown out.