random number between -1 and 1
조회 수: 31 (최근 30일)
이전 댓글 표시
Hi I need a 1 line code for a random number generator between 1 and -1 for one element.
댓글 수: 0
채택된 답변
Wayne King
2012년 4월 15일
Do you want these uniform between -1 and 1?
r = -1 + 2.*rand(100,1);
For 1 such number
r = -1+2*rand(1,1);
댓글 수: 1
Jan
2012년 4월 15일
@Mate 2u: If you read the help text of RAND you find corresponding examples. Please take the time to read the help and doc.
추가 답변 (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!