algorithm – How can i generate random mapas in 2d


I want to generate maps in 2d, likes to this:
enter image description here
there are some algorithm?

i want to draw the road and put my player over to those areas to go running, its posible?

i am not using any engine to draw, i dont want to use any library, i want draw with algoritms, putpixel(x,y)