Generate random integer array
조회 수: 1(최근 30일)
표시 이전 댓글
I need to create an array of random integers. The array must consist of at least two numbers greater than one but there is no maximum array length. The elements of the array need to sum to less than 46. Thanks for your help.
채택된 답변
Image Analyst
2017년 1월 25일
I was about the say the same thing as Steven. Because it's card dealing, you need to use randperm(), not randi(). See my two attached car dealing demos.
댓글 수: 0
추가 답변(1개)
Steven Lord
2017년 1월 25일
If you're looking to shuffle a deck of cards, use randperm. Once you have a vector representing the shuffled deck of cards, use indexing to extract subsets of the vector to represent each of your piles.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!