# Uniform Distribution (Continuous) fit on data

조회 수: 2 (최근 30일)
milad babaei 2011년 11월 4일
Hi,
i have a variable 1 <B< 8 ,which i want to pick up randomly each time 1 number(B also could be 1 and 8), (which each value has the same probability of occurrence)so how could i produce uniformly random number between 1 and 8 ??

댓글을 달려면 로그인하십시오.

### 채택된 답변

Amith Kamath 2011년 11월 4일
Generate values from the uniform distribution on the interval [a, b]:
r = a + (b-a).*rand(100,1);
or if you'd want the numbers to be integers,
Use the randi function, instead of rand, to generate integer values from the uniform distribution on the set 1:100:
r = randi(100,1,5);
Although you must note that these numbers are pseudorandom, in that no computer system can in reality generate purely random numbers!

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Multivariate t Distribution에 대해 자세히 알아보기

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by