The first thing I did when I learned python was to write a tetris game in it (using PyGame). So the first thing I did was look at the random piece generator in the go version. It just picks one at random:
g.piece = 1 + rand.Int()%numTypes
However, the official tetris guidelines say that the 7 types of pieces should all be selected in a random order, as if taken from a bag. After all 7 pieces are picked, you can put all of the pieces back in the bag and select again in a random order. [1]Of course, you don't HAVE to follow the official guidelines. I just thought it would be fun to compare.