mercredi 21 décembre 2016

Alternative to cstdlib's rand() [duplicate]

This question already has an answer here:

Is there an alternative to rand()?Since rand()(at least for me)is freaking broken.So if you know an alternative to rand() in c++ please tell me.Since every time i run this simple code:

Code:

#include <iostream>
#include <cstdlib>

using namespace std;

void Gla()
{
  int L;
  L = rand();
  while(1)
  {
      cout<<L<<endl;
  }
}


int main()
{
    Gla();
    return 0;
}

It continously outputs 41, i don't know why it just does.




Aucun commentaire:

Enregistrer un commentaire