This is just a very basic idea to start you off:
Generate random points.
Repeatedly connect two random points by moving only vertically from the one point and horizontally from the other (there are two ways to do this). See example for more details.
Assuming you want a non-splitting path, these chosen points should not both already be connected to any other points (but one already having been connected is fine).
Backtrack if you get stuck (if you can't connect a point to anything or you've made a path from start to finish and there are points outstanding) and/or restrict how you pick points in such a way to prevent / reduce the probability of getting stuck. Connecting the start and end points to start, for example, won't get you anywhere.
For example, to get to your maze:
The randomly generated points will look like this: (note that the start and end-points could be fixed here, or at least be constrained to (certain?) sides)
1 / / / / / / / / /
/ / / / / / 4 / / /
/ / / / / / / / / /
/ / / / 3 / / / / /
/ / / / / / / / / /
/ 2 / / / / / / / /
/ / / / / / / / 5 6
Then you connect 1 and 3 by moving horizontally from 1 and vertically from 3. An alternative would've been moving vertically from 1 and horizontally from 3.
1 * * * # / / / / /
/ / / / * / 4 / / /
/ / / / * / / / / /
/ / / / 3 / / / / /
/ / / / / / / / / /
/ 2 / / / / / / / /
/ / / / / / / / 5 6
Then you connect 3 and 2, 2 and 4, 4 and 5 and 5 and 6 in the same way.
Note that when connecting 5 and 6, they can only be directly connected with no intersection point since they lie on the same horizontal line. Or you can think of it as either 5 or 6 moving vertically by 0 units.