Along the lines of using random numbers to make game content: I have made a game called "Ransack the Xmass Ninja" that randomly generates game maps. The download is here:
http://www.monkeydev.com/Ransack/index.htmThe algorithm to generate the map works like this:
1) A map size is specified by the user which makes a 2 dimensional integer array populated with all 0's, except for the border which is populated with all 2's. (fyi 0's indicate traversable space, 1's indicate traversable space with a different ground texture in this case water, and 2's indicate non traversable wall).
2) The computer then picks a random x and a y integer that lies within the width and height of the array.
3) The computer also picks a segment file from the maps folder. This Segment file contains a 10x10 chunk of map that looks naturally formed, but was really hard coded by me ahead of time.
4) The computer inserts the chunk of map into the main map at the random x and y coordinates chosen. The insert is done like this:
4a) The 10x10 map segment is iterated by an x and a y iterator.
4b) Each value from the file is compared to the map array at point (xrand+xiter, yrand+yiter).
4c) If the value of the file at (xiter,iter) is greater than the map value at(xrand+xiter, yrand+yiter), the map value is changed. Otherwise the map value stays the same. In simpler terms if there is no wall we make one, but we do not remove existing walls.
5) Steps 2-4 are repeated until the map is done. The number of times repeated will depend on how big the map is. I advise you to use trial and error on specific map sizes. Just change the number of iterations until it looks right.
6) Place the level entrance and exit randomly in the map.
6a) select a random point for the level entrance
6b) if that point lies inside a wall (map array value == 2) pick a new point.
6c) select a random point for a the level exit
6d) it that point lies inside a wall or is too close to the level entrance pick a new point.
7) We must now validate the map to make sure the user is not dead ended from the level exit.
7a) Make a temporary boolean array the size of the integer map array.
7b) Set all values of the array to false.
7c) Use the recursive flood fill algorithm to find out which map points can be reached.
7ca(sorry I don't know how else to properly list this step)) start the recursive function at the map entrance.
7cb) Set the boolean array value at the current position to true to indicate we can reach this point from the start location.
7cc) If the point to the left of the current position (x-1,y) is not a wall and not already visited (the boolean array of that location shows false), call the recursive function at step 7cb only using (x-1,y) as the current position.
7cd) do the same check and call of the recursive function for positions (x+1,y) (x,y-1), and (x,y+1).
7d) When step 7c runs out of places to check the boolean array will represent all places in the map the user can legitimately reach.
7e) If the percentage of reachable space is less than 1/3 the total map space we have generated an un interesting map and should probably start all over from step 2. Don't worry the computer doesn't mind repetitive tasks.
7f) If the exit point is not within reachable space you will have to relocate it, or generate a new map.
There you go, pseudo code for generating random maze like dungeons. In all honesty Diablo inspired me to make this. I know my random generator does not hold a candle to theirs, but I like to think we were working off the same principles. If you want to see my poorly commented source code look here:
http://xmashack.bafsoft.com/2006/downloadsfor Ransack by Wilson Saunders.