rand command give different answer

mat.jpg
why this rand command give different result

1 comentario

Stephen23
Stephen23 el 9 de Feb. de 2020
"why this rand command give different result"
What do you expect its output to be?

Iniciar sesión para comentar.

Respuestas (2)

James Tursa
James Tursa el 9 de Feb. de 2020
Editada: James Tursa el 9 de Feb. de 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 comentario

Iqra
Iqra el 6 de En. de 2023
beacuse rand function generates value randamly between 0 and 1 interval

Iniciar sesión para comentar.

Chuguang Pan
Chuguang Pan el 9 de Feb. de 2020

0 votos

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.

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Productos

Versión

R2019a

Etiquetas

Preguntada:

el 9 de Feb. de 2020

Comentada:

el 6 de En. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by