Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
genrating random numbers

Subject: genrating random numbers

From: asma khalid

Date: 11 Nov, 2010 12:31:04

Message: 1 of 3

If i want to generate 10 random numbers say x and y where x=(x1,...x10) and y=(y1,...,y10) such that x1<y1
                                  x2<y2
                                        .
                                         .
                                  x10<y10
how should i do that?

Subject: genrating random numbers

From: Bruno Luong

Date: 11 Nov, 2010 12:56:05

Message: 2 of 3

xy = sort(rand(2,10));
x = xy(1,:)
y = xy(2,:)

Bruno

Subject: genrating random numbers

From: Sean

Date: 11 Nov, 2010 12:58:04

Message: 3 of 3

"asma khalid" <asma_167@hotmail.com> wrote in message <ibgnm8$s11$1@fred.mathworks.com>...
> If i want to generate 10 random numbers say x and y where x=(x1,...x10) and y=(y1,...,y10) such that x1<y1
> x2<y2
> .
> .
> x10<y10
> how should i do that?

Don't start new threads, you already have a thread going for this question.

I'll repost:

A = sort(rand(10,2),2); %data
x = A(:,1); %smaller data
y = A(:,2); %bigger data

%Insure results
all(x<y)

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us