# I want to generate a fixed percent of random points on a straight line joining two points.

5 views (last 30 days)

Show older comments

### Accepted Answer

Torsten
on 3 Aug 2016

Instead of generating 100 random numbers, use "rand" to generate 5 random numbers on [0:1] and set the points to

lambda=rand(5,1);

x=x1+lambda*(x2-x1);

y=y1+lambda*(y2-y1);

Best wishes

Torsten.

##### 5 Comments

### More Answers (0)

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!