And, no, I didn't find the values by hand...

@i='458441005222895647973137125730975323984043625316'=~/.{8}/g; map{srand$i[$_];map{print chr(32+int(rand 59))}1..4}0..5;
Tom Melly, pm@tomandlu.co.uk

Replies are listed 'Best First'.
Re: JAPH - more obscure than obfuscated...
by liverpole (Monsignor) on Nov 29, 2006 at 19:25 UTC
    Melly++, even though it's system-dependent, for a very clever, if not unique strategy.

    Here's a version which works for Perl version 5.8.0 i386-linux-thread-multi:

    @i='058233660927207121220869229603962185544803008278'=~/.{8}/g; map{srand$i[$_];map{print chr(32+int(rand 59))}1..4}0..5;

    Update:  Changed "unique" to "clever", after ambrus' observation below.  Actually, his reference alludes to an even earlier version with a similar concept.  Just goes to show that great minds think alike!


    s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
Re: JAPH - more obscure than obfuscated...
by Tanktalus (Canon) on Nov 29, 2006 at 16:24 UTC

    I'm not sure I'm getting what you think I'm getting ... ;-)

    My output looks like this:

    1:2'E&T8DD-'# N$L3HW#7&
    I think it has something to do with being on a different platform and/or different version of perl. ;-) (Linux/x86-32, perl 5.8.8)

    It is, however, consistent. As I expected. And, I'm sure, as you expected. ;-)

      Heh. FWIW, I get the same output on perl 5.8.4 (both x86-32 and x86-64), 5.8.7 and 5.8.8.

        Heh - probably OS specific (Win2k for me).

        I get JUST ANOTHER PERL HACKER (but you probably guessed that ;)

        map{$a=1-$_/10;map{$d=$a;$e=$b=$_/20-2;map{($d,$e)=(2*$d*$e+$a,$e** 2-$d**2+$b);$c=$d**2+$e**2>4?_:0}1..99;print$c}0..59;print$/}0..20;
        Tom Melly, pm@tomandlu.co.uk
Re: JAPH - more obscure than obfuscated...
by ambrus (Abbot) on Nov 29, 2006 at 19:26 UTC

      Thanks for the ++'s - although it brings me closer to the dreaded day when I stop being a Pilgrim (cool!) and become a Friar (not cool)

      So rand is random... how... appropriate ;)

      Here's the cross-platform version then...(wot, you mean there are other platforms apart from Win and Linux?)

      @i='058233660927207121220869229603962185544803008278'=~/.{8}/g; @i='458441005222895647973137125730975323984043625316'=~/.{8}/g if$^Oeq +'MSWin32'; map{srand$i[$_];map{print chr(32+int(rand 59))}1..4}0..5;
      Tom Melly, pm@tomandlu.co.uk