How can I use random numbers in Linux and C++?
I have found some code I would like to use, it has the line
srand((unsigned)time(0));//seed
but gcc says
board.cpp:94:24: error: ‘time’ was not declared in this scope
I have included the following files
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <algorithm>
You'll need
#include <ctime>
to access the time
function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With