# Generate 10000 numbers using RAND with probability

29 views (last 30 days)
dlafont on 30 Mar 2022
Answered: Ganesh shankar ram on 15 Nov 2022 at 6:15
1. Given a sequence of U(0,1) random numbers, obtain and describe an algorithm that generate binary random numbers with the following point masses:
P{X = 0} = 0.3, P{X = 1} = 0.7
• Use MATLAB (0, ) random number generator “rand” to generate 10,000 random numbers with the above distribution.
• Compute the average value of the 10,000 numbers generated. Compare it with the theoretical mean.
• Give the percentages of the numbers generated that are equal to -1,0, and 1, respectively. Compare them with the point masses and make a comment.
dlafont on 31 Mar 2022
Ooops Fixed, still getting same error tho

Geoff Hayes on 31 Mar 2022
@dlafont - from the error, I think that you have a custom script called rand.m that is is conflicting with the MATLAB rand function. I recommend you delete the /MATLAB Drive/rand.m (or better, rename this file) and try again.
dlafont on 31 Mar 2022
THANK U!!! It finally worked

Ganesh shankar ram on 15 Nov 2022 at 6:15
Generate Random Sequences of length 10000
uniformly distributed over the interval 0 and0.5

### Categories

Find more on Logical in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!