Since today is October 31...

H

Hal Fulton

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


Cheers,
Hal(loween)9000
 
J

James Britt

Hal said:
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
 
W

Wejn

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)[/QUOTE]
 
H

Hal Fulton

Wejn said:
Hello,




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
 
W

Wejn

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.[/QUOTE]
 
H

Hal Fulton

Wejn said:
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
 
W

why the lucky stiff

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

:) nothing scarier than Enumerable#inject though...

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

_why
 
D

Daniel Carrera

:) nothing scarier than Enumerable#inject though...

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

Now THAT was cool!
 
H

Hal Fulton

Daniel said:
:) nothing scarier than Enumerable#inject though...

(0..67).inject(3709168338536711372250064398972826945394701253532720163819002017081215416156693026){|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
 
W

Wejn

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.[/QUOTE]
 
N

Nathan Weston

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
 
G

gabriele renzi

il 31 Oct 2003 15:39:25 -0800, (e-mail address removed) (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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top