Run time is number of lines, memory usage is max longest line, you can't get better than this (though it's a bit slow because of how it gets random values, and how often)..