How to generate random numbers for a secified limit

2 views (last 30 days)
how can i generate random numbers for X and Y with the limits specified below.
0<x<2 and 0<y<2x-x^2.

Answers (1)

M
M on 2 Nov 2017
From the rand documentation :
Generate values from the uniform distribution on the interval (a, b) :
r = a + (b-a).*rand(100,1);

Categories

Find more on Random Number Generation 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!