C++ random no generator problem in my personal project

Project Description:-
I am trying to produce a program that will record multiple students academic grade (out of 100)
and sort which student have highest avg. grade without any subject failure (which is less than 40).

Problem Description:-
for each student i have to give grade for 10 subject so i create random no generator from 0-100 and feed it to each subject(i.e 10 subject)
Case 1:

it produce same no. each time due to no time delay. as shown below

so i added time delay function as shown in case 2

Case 2:
image

o/p-

but i added 1 sec time delay(less than that it will produce wrong o/p as seen in case1)
due to time delay of 1 second to generate 10 o/p for 1 student it takes 10 seconds(so for 1000 students it will take 10000sec which is almost 167 min)

so how to reduce this time delay or in milliseconds how i produce desired o/p…please help
(source code:-https://gist.github.com/NuclearNadal2893/459777168296652acc71423aa0651da3)

I think you misunderstand what srand does, have you read documentation for it?

Sorry for your time i found the answer…which as you say misunderstanding of srand() function

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.