Random number generator help
조회 수: 2 (최근 30일)
이전 댓글 표시
I am looking to generate random numbers between a certain set of decimal numbers (for eg: 0.3 to 0.4). I tried using rand command but if anyone has a workaround?
댓글 수: 0
채택된 답변
Voss
2022년 5월 31일
rand gives you number(s) between 0 and 1, so with appropriate scaling and offsetting, you can use it to get number(s) from any given range:
data = 0.3 + 0.1*rand(1,100) % 100 numbers between 0.3 and 0.4
plot(data)
댓글 수: 0
추가 답변 (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!