using the mod function to create and even random number generator in matlab
조회 수: 28 (최근 30일)
이전 댓글 표시
using the vector i created called random20
random20 = randi ([0,100],1,20);
how do i use the mod function to get all even random integers
any help would be appreciated.
댓글 수: 2
James Tursa
2020년 1월 27일
편집: James Tursa
2020년 1월 27일
Hint: What does mod(random20,2) give you? Can you use that to get the even ones?
답변 (1개)
John D'Errico
2020년 1월 27일
Why do you need the mod function? Just generate random integers, and then MULTIPLY THEM BY 2.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Random Number Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!