(progn
(setq x (random 50))
(dotimes (y x) (print (format "%d" y) (current-buffer))))
とか?