generating random numbers only 2 numbers

8 visualizaciones (últimos 30 días)
Takim Mustakim
Takim Mustakim el 17 de Sept. de 2021
Comentada: Chunru el 17 de Sept. de 2021
i want to generating random numbers on matrix 1x30
how i get generating 2 random numbers (only 1 and 4 , not between) ???

Respuesta aceptada

Chunru
Chunru el 17 de Sept. de 2021
Editada: Chunru el 17 de Sept. de 2021
a = randi([0 1], [1 30])*3 + 1
a = 1×30
1 1 4 4 4 4 4 1 1 4 1 4 4 4 1 4 4 4 1 1 1 4 1 4 4 1 4 4 4 4
  2 comentarios
Takim Mustakim
Takim Mustakim el 17 de Sept. de 2021
ohhhh thank you bro/sist
Chunru
Chunru el 17 de Sept. de 2021
Consider to accept the answer.

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.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by