I'm attempting to populate an array of 256 elements with randomly generated integers between 0 and 1024 in C as my language of choice for a DSA class. After doing some research, I found that this could be a viable solution:
int A[256];
for (int i = 0; i < 256 ; i++)
{
A[i] = (rand() % 1024 + 0);
}
However, I then noticed that the rand
function populates in a pseudo-random manner. In this case, what is the difference between 'random' and 'pseudorandom'? If there is a significant difference, is there a way to implement this in a way that could be done in a random manner in C?
TIA
Aucun commentaire:
Enregistrer un commentaire