This page shows how to generate a random number within
range.
It is implemented as part of a c++
series of exercises
, that I did.
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- using namespace std;
- #include "ecc_calc.h"
- int main() {
- int i;
- unsigned char a_data[ARRAY_SZ];
- srand ( time(NULL) );
- //for(i=0; i < ARRAY_SZ; i++) a_data[i]=(i > 0) ? 0 : 4;
- for(i=0; i < ARRAY_SZ; i++) a_data[i]=rand() % 256;
- c_ecc *ecc;
- ecc = new c_ecc(a_data);
- delete ecc;
- return 0;
- }
|