I want to generate a matrix of random numbers between 0 and 2.5 with length=8 and the sum of generated numbers be 20
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Mausmi Verma
il 22 Ott 2021
Commentato: the cyclist
il 22 Ott 2021
I want to generate a matrix of random numbers between 0 and 2.5
The length of generated matrix should be 8 and the total sum of generated matrix should be 20.
need help
thanks in advance
0 Commenti
Risposta accettata
the cyclist
il 22 Ott 2021
Modificato: the cyclist
il 22 Ott 2021
2 Commenti
the cyclist
il 22 Ott 2021
I read your question a bit more closely.
Of course, there is only one way to have 8 numbers that sum to 20, if the max is 2.5, which is to have all the numbers equal 2.5.
So, this function has returned the correct and only answer.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Random Number Generation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!