Effacer les filtres
Effacer les filtres

rand command give different answer

1 vue (au cours des 30 derniers jours)
Abdullah Haris
Abdullah Haris le 9 Fév 2020
Commenté : Iqra le 6 Jan 2023
mat.jpg
why this rand command give different result
  1 commentaire
Stephen23
Stephen23 le 9 Fév 2020
"why this rand command give different result"
What do you expect its output to be?

Connectez-vous pour commenter.

Réponses (2)

James Tursa
James Tursa le 9 Fév 2020
Modifié(e) : James Tursa le 9 Fév 2020
rand( ) is a random number generator ... it is supposed to give a different result.
doc rand
If you want to start over with the same stream of numbers you will need to re-seed it.
  1 commentaire
Iqra
Iqra le 6 Jan 2023
beacuse rand function generates value randamly between 0 and 1 interval

Connectez-vous pour commenter.


Chuguang Pan
Chuguang Pan le 9 Fév 2020
All the random number functions, rand, randn, randi, and randperm, draw values from a shared random number generator. Every time you start MATLAB, the generator resets itself to the same state.
The rand function draw values from a RandStream.

Catégories

En savoir plus sur Random Number Generation dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by