Borrar filtros
Borrar filtros

How to generate a random decimal number between 1.0 and 1.52?

1 visualización (últimos 30 días)
rand([1.0,1]);
May I know why this is not working?

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 29 de Oct. de 2020
Editada: Ameer Hamza el 29 de Oct. de 2020
You can generate them by scaling and translating the output of rand()
range = [1.0,1.52];
x = rand()*diff(range)+range(1)
  2 comentarios
Wen Shu Wong
Wen Shu Wong el 29 de Oct. de 2020
Thank you! what if I would like to generate between [0,1.52]?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by