in reply to How to not print the same random number

This may give you what you want:

use strict; use warnings; print join"\n",grep$_,map{our%s;my$n=1+int rand(10);$s{$n}++?0:$n}1..1 +00;

DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: How to not print the same random number
by ysth (Canon) on Mar 05, 2006 at 07:56 UTC
    I like the "may" part. Did you calculate the actual odds?

      Statistics is not my strong suit. I ran a test version a few times and noticed that about 23-25 itterations sufficed often enough and guessed that 100 would seldom dissapoint. Glad you noticed the "may". :)


      DWIM is Perl's answer to Gödel