Q:

How to randomly generate (x, y) points following a linear equation?

I have a equation y=9x+6. I want to extract 10 random points from this function. How should I proceed?

A:

Generate 10 random x-values, in this example uniformly distributed (function runif), and then calculate the corresponding y-values following your equation.
You can control the x-range by setting different min and max parameters to function runif.
x <- runif(10, min = 0, max = 1)
y <- 9*x+6
plot(x,y)

