Random()


#1

how doe the random() function work? It is not that random because I have exactly the same employees and assets as in the book.


#2

To get random numbers, call the srandomdev function once (when your program starts up) before you call the random function:

...
srandomdev ();
...
long randomNumber = random ();
...

Or simply use the arc4random or arc4random_uniform functions instead.


#3

And why isn’t it like that in the book?