It's about 1500 lines of code - just checked. Not sure how to feed that to you. In general though, if I recall, it picks a side of the map to start on, and an x or y position there. It chooses a different side of the map to target as an end point. It likely uses Bresenham's Algorithm to start wandering in that direction, but with random variables thrown at it to bump it off course every so often. It determines a thickness (randomly) and then retraces the steps to fill in the extra squares for that, offset. It checks randomly to see if we want any forks, and if so, how many. For each fork, pick a random point in the river, then a random map edge and repeat the process between those two points.