Borrar filtros
Borrar filtros

Create a set of 165 random numbers

7 visualizaciones (últimos 30 días)
Johanna Popp
Johanna Popp el 9 de Ag. de 2021
Editada: Johanna Popp el 9 de Ag. de 2021
Hi all,
I would like to create a set of 165 random numbers within the range of 1:557 so that the radom numbers are distributed equally in groups of 10 numbers. Here is an example, to make my problem more clear:
1:10 --> 3 random numbers (say 3,6,7)
11:20 --> 3 random numbers (say 11,15,18)
21:30 --> 3 random number (say 26,27,28)
.
.
541:550 --> 3 random numbers (say 542,544, 547)
I hope my problem is clear...
All help is appreciated, thanks!

Respuesta aceptada

KSSV
KSSV el 9 de Ag. de 2021
Read about randsample, randperm.
  1 comentario
Johanna Popp
Johanna Popp el 9 de Ag. de 2021
Editada: Johanna Popp el 9 de Ag. de 2021
Thank you, I think I got it:
group = (i*10+1):((i*10)+10);
y = randsample(group,3,false)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by