Since today is October 31...

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default Since today is October 31...

    srand 0
    puts "pH p!aoHalnyweel".split("").sort {|x,y| rand <=> rand }.join


    Cheers,
    Hal(loween)9000



    Hal Fulton Guest

  2. Similar Questions and Discussions

    1. #39311 [Opn->Bgs]: mktime() doesn't work after 28 October 2006
      ID: 39311 Updated by: derick@php.net Reported By: xg_wahyu at yahoo dot com -Status: Open +Status: ...
    2. #39311 [NEW]: mktime() doesn't work after 28 October 2006
      From: xg_wahyu at yahoo dot com Operating system: Windows XP PHP version: 5.1.6 PHP Bug Type: Date/time related Bug...
    3. Weird! Problem of query the date for January and October
      It's weird! I am writing an asp code to retireving data from the MS access. Any records before today will not be populated. It works fine except...
    4. Caching Technologies Webcast October 1
      Caching Technologies Webcast October 1 Speaker: Dr. C. Mohan, IBM Almaden Research Center Date: October 1, 2003 Time: 11-12:30 ET, 4-5:30 GMT...
    5. OT- Europe tour in October
      My new band that I'm in is headed to the Euro scene in late September/ early October. The band is "Mississippi Mud" and is kinda like The doors...
  3. #2

    Default Re: Since today is October 31...

    Hal Fulton wrote:
    > srand 0
    > puts "pH p!aoHalnyweel".split("").sort {|x,y| rand <=> rand }.join
    >
    Neat.

    When I saw the subject line, I thought you were going to say something
    scary, like Matz had decided to drop Ruby and devote his time to Java 1.6.


    James
    >
    > Cheers,
    > Hal(loween)9000
    >
    >
    >
    >



    James Britt Guest

  4. #3

    Default Re: Since today is October 31...

    Hello,
    > srand 0
    > puts "pH p!aoHalnyweel".split("").sort {|x,y| rand <=> rand }.join
    hmm, it doesn't work for me :-(

    irb(main):001:0> srand 0
    0
    irb(main):002:0> puts "pH p!aoHalnyweel".split("").sort {|x,y| rand <=> rand }.join
    HHypao!new llpea
    nil
    irb(main):003:0> VERSION
    "1.6.7"

    M.

    PS: It's strange to have Halloween one day after Christmas. :-)
    (Clue: 24 dec == 30 oct)
    --
    Wejn <lists+rubytalk(at)box.cz>
    (svamberk.net's Linux section, fi.muni.cz student, linuxfan)
    >>> Bored? Want hours of entertainment? <<<
    >>> Just set the initdefault to 6! <<<
    Wejn Guest

  5. #4

    Default Re: Since today is October 31...

    Wejn wrote:
    > Hello,
    >
    >
    >>srand 0
    >>puts "pH p!aoHalnyweel".split("").sort {|x,y| rand <=> rand }.join
    >
    >
    > hmm, it doesn't work for me :-(
    >
    > irb(main):001:0> srand 0
    > 0
    > irb(main):002:0> puts "pH p!aoHalnyweel".split("").sort {|x,y| rand <=> rand }.join
    > HHypao!new llpea
    > nil
    > irb(main):003:0> VERSION
    > "1.6.7"
    No, that's because the PRNG changed with 1.7.x

    If you are using 1.6.7, you are missing a few nice features. :)
    > PS: It's strange to have Halloween one day after Christmas. :-)
    > (Clue: 24 dec == 30 oct)
    Yes, I first heard that Halloween was Christmas from Richard
    Hamming (of Hamming Code fame). Not directly of course. He wrote
    the coding theory textbook I used in college.

    Hal


    Hal Fulton Guest

  6. #5

    Default Re: Since today is October 31...

    On Sat, Nov 01, 2003 at 05:55:28AM +0900, Wejn wrote:
    > hmm, it doesn't work for me :-(
    You should upgrade to 1.8. But meanwhile, just for you:

    irb(main):001:0> VERSION
    "1.6.7"
    irb(main):002:0> srand 0
    0
    irb(main):003:0> puts "paoeH! Hywapllne".split("").sort{rand<=>rand}.join

    -Mark
    Mark J. Reed Guest

  7. #6

    Default Re: Since today is October 31...

    Hello,
    > If you are using 1.6.7, you are missing a few nice features. :)
    yeah, I know ... :-/ But I'm just too lazy to reinstall Ruby on all
    the boxes I happen to use. :-)
    > Yes, I first heard that Halloween was Christmas from Richard
    > Hamming (of Hamming Code fame). Not directly of course. He wrote
    > the coding theory textbook I used in college.
    Wow ... Hamming code reminds me my Crypto&Coding course I had 2 semesters
    ago - quite impressive material (and I must admit it was hard time for me
    - trying to learn/understand all the things). Please, is that textbook
    available somewhere on the Net?

    Sincerely,
    M.
    --
    Wejn <lists+rubytalk(at)box.cz>
    (svamberk.net's Linux section, fi.muni.cz student, linuxfan)
    >>> Bored? Want hours of entertainment? <<<
    >>> Just set the initdefault to 6! <<<
    Wejn Guest

  8. #7

    Default Re: Since today is October 31...

    Wejn wrote:
    > Wow ... Hamming code reminds me my Crypto&Coding course I had 2 semesters
    > ago - quite impressive material (and I must admit it was hard time for me
    > - trying to learn/understand all the things). Please, is that textbook
    > available somewhere on the Net?
    Hmm, not that I know of.

    I still have it on my shelf, though. :) _Coding and Information
    Theory_, Richard Hamming.

    Great book, interesting topic, and yes, sometimes it's hard to
    understand.

    Hal



    Hal Fulton Guest

  9. #8

    Default Re: Since today is October 31...

    On Friday 31 October 2003 12:17 pm, Hal Fulton wrote:
    > srand 0
    > puts "pH p!aoHalnyweel".split("").sort {|x,y| rand <=> rand }.join
    :) nothing scarier than Enumerable#inject though...

    (0..67).inject(37091683385367113722500643989728269 45394701253532720163819002017081215416156693026){| i,x|print
    "o! _,\\`\n/^.>b<"[i%16,1];i>>4}

    _why

    why the lucky stiff Guest

  10. #9

    Default Re: Since today is October 31...

    On Sat, Nov 01, 2003 at 07:02:57AM +0900, why the lucky stiff wrote:
    >
    > :) nothing scarier than Enumerable#inject though...
    >
    > (0..67).inject(37091683385367113722500643989728269 45394701253532720163819002017081215416156693026){| i,x|print
    > "o! _,\\`\n/^.>b<"[i%16,1];i>>4}
    >
    Now THAT was cool!


    --
    Daniel Carrera | OpenPGP KeyID: 9AF77A88
    PhD grad student. |
    Mathematics Dept. | "To understand recursion, you must first
    UMD, College Park | understand recursion".

    Daniel Carrera Guest

  11. #10

    Default Re: Since today is October 31...

    Daniel Carrera wrote:
    > On Sat, Nov 01, 2003 at 07:02:57AM +0900, why the lucky stiff wrote:
    >
    >>:) nothing scarier than Enumerable#inject though...
    >>
    >>(0..67).inject(370916833853671137225006439897282 6945394701253532720163819002017081215416156693026) {|i,x|print
    >>"o! _,\\`\n/^.>b<"[i%16,1];i>>4}
    >>
    >
    >
    > Now THAT was cool!
    >
    I'm sure it is... but it doesn't work for me. (self.wtf?)

    I pasted quite carefully, too.

    This is ruby 1.8.0 (2003-08-04) [i686-linux-gnu]
    All I get is a bunch of nils...

    Hmmmm.

    Hal



    Hal Fulton Guest

  12. #11

    Default Re: Since today is October 31...

    It looks like pre-1.7, Ruby's PRNG was the same as Perl 5.8's. But
    apparently their sorting algorithms differ, since the requisite
    string for the equivalent Perl code is yet a third: "yHHplelaew!an po".

    Python seems to take a 0 argument to rand.srand to mean "randomize
    for real, yo!"; but with rand.srand(1), "l Hpw!aHeeoanlpy" yields the
    desired result.

    ANYway.

    -Mark
    Mark J. Reed Guest

  13. #12

    Default Re: Since today is October 31...

    On Sat, Nov 01, 2003 at 07:10:25AM +0900, Hal Fulton wrote:
    > Daniel Carrera wrote:
    > >On Sat, Nov 01, 2003 at 07:02:57AM +0900, why the lucky stiff wrote:
    > >
    > >>:) nothing scarier than Enumerable#inject though...
    > >>
    > >>(0..67).inject(370916833853671137225006439897282 6945394701253532720163819002017081215416156693026) {|i,x|print
    > >>"o! _,\\`\n/^.>b<"[i%16,1];i>>4}
    > >>
    > >
    > >
    > >Now THAT was cool!
    > >
    >
    > I'm sure it is... but it doesn't work for me. (self.wtf?)
    >
    > I pasted quite carefully, too.
    Sounds like you missed the last line, though. If you just stop after
    the "print" and add a }, you get the nils.


    -Mark
    Mark J. Reed Guest

  14. #13

    Default Re: Since today is October 31...

    Hi,
    > I'm sure it is... but it doesn't work for me. (self.wtf?)
    >
    > I pasted quite carefully, too.
    >
    > This is ruby 1.8.0 (2003-08-04) [i686-linux-gnu]
    > All I get is a bunch of nils...
    >
    > Hmmmm.
    ran into same problem ... after removing the newline after print
    it worked :-)

    M.
    --
    Wejn <lists+rubytalk(at)box.cz>
    (svamberk.net's Linux section, fi.muni.cz student, linuxfan)
    >>> Bored? Want hours of entertainment? <<<
    >>> Just set the initdefault to 6! <<<
    Wejn Guest

  15. #14

    Default Re: Since today is October 31...

    Wejn wrote:
    > Hi,
    >
    >
    >>I'm sure it is... but it doesn't work for me. (self.wtf?)
    >>
    >>I pasted quite carefully, too.
    >>
    >>This is ruby 1.8.0 (2003-08-04) [i686-linux-gnu]
    >>All I get is a bunch of nils...
    >>
    >>Hmmmm.
    >
    >
    > ran into same problem ... after removing the newline after print
    > it worked :-)
    Oh, of course, of course.

    Thanks...

    Hal


    Hal Fulton Guest

  16. #15

    Default Re: Since today is October 31...

    Hmm... under ruby 1.6.7 this prints:
    HHypao!new llpea

    Which I don't think was what you meant... ;-)
    It works in 1.8 though.

    Nathan


    James Britt <jamesUNDERBARb@seemyemail.com> wrote in message news:<3FA2BEB3.5060708@seemyemail.com>...
    > Hal Fulton wrote:
    >
    > > srand 0
    > > puts "pH p!aoHalnyweel".split("").sort {|x,y| rand <=> rand }.join
    > >
    >
    > Neat.
    >
    > When I saw the subject line, I thought you were going to say something
    > scary, like Matz had decided to drop Ruby and devote his time to Java 1.6.
    >
    >
    > James
    >
    > >
    > > Cheers,
    > > Hal(loween)9000
    > >
    > >
    > >
    > >
    Nathan Weston Guest

  17. #16

    Default Re: Since today is October 31...

    il 31 Oct 2003 15:39:25 -0800, [email]elbows@spamcop.net[/email] (Nathan Weston) ha
    scritto::
    >Hmm... under ruby 1.6.7 this prints:
    >HHypao!new llpea
    >
    >Which I don't think was what you meant... ;-)
    >It works in 1.8 though.
    well, in 1.8 we are using mersenne twister as the PRNG
    gabriele renzi Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139