dimanche 22 octobre 2017

How to generate random number in Matlab?

Hey guys I'm really new to Matlab. I'm trying to learn the basic functions. I would like to do this command in Matlab.

Generate 50, 000 independent pseudo-random numbers (uniform numbers), by calculator or computer. Each person should generate his or her own numbers. Print out the 40 first numbers.

In C++ you can do something like this.

double normalizedRandom(void) {

  return ((double)rand())/RAND_MAX;

}

and in the main function you have to seed the random function

int main(void) {

  // seed the random function

  srand(time(0));

Can you help me do this command in Malab?

Aucun commentaire:

Enregistrer un commentaire