(i am a beginner at this platform and at programming too. please ignore my immature mistakes if you notice any. Thank you)
this is the c code below for generating a random number :
#include <stdio.h>
#include <time.h>
int main(int argc, char const *argv[])
{
printf("%d\n",rand() );
}
and in python :
from random import randint
print(randint(0,100))
my question is why c is always generating the same random number after i run the program again and again while python is able to do it by giving out new random number everytime .Not asking about the algorithm for generating the number but why same number ? is it because python is interpreted while c is compiled ?
Aucun commentaire:
Enregistrer un commentaire