[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: rand random. You've got to be kidding

brabuhr

11/28/2006 6:08:00 PM

On 11/28/06, Smgspices@aol.com <Smgspices@aol.com> wrote:
> Surely it must be possible to initialize rand with current date and time.
> Documents seem to indicate this is done with rand(0) or srand with no value. I
> have tried both methods and I get the same tired old sequence of numbers. I
> would write my own random number generator except I don't know how to get a
> numeric value out of Time.

Can you post the code that isn't working for you?

http://www.rubycentral.com/ref/ref_m_kernel...
http://www.rubycentral.com/ref/ref_m_kernel....

> ruby -e 'print "#{rand}\t#{rand}\t#{rand}\n"'
0.346093491828657 0.0992270243895501 0.491676115802907
> ruby -e 'print "#{rand}\t#{rand}\t#{rand}\n"'
0.11466702118189 0.0119319523512537 0.111031191235015
> ruby -e 'print "#{rand}\t#{rand}\t#{rand}\n"'
0.282694845926778 0.570101702949362 0.303077309354919

> ruby -e 'srand(1); print "#{rand}\t#{rand}\t#{rand}\n"'
0.417022004702574 0.720324493442158 0.000114374817344887
> ruby -e 'srand(1); print "#{rand}\t#{rand}\t#{rand}\n"'
0.417022004702574 0.720324493442158 0.000114374817344887
> ruby -e 'srand(1); print "#{rand}\t#{rand}\t#{rand}\n"'
0.417022004702574 0.720324493442158 0.000114374817344887

> ruby -e 'srand(2); print "#{rand}\t#{rand}\t#{rand}\n"'
0.435994902142004 0.0259262318278913 0.549662477878709
> ruby -e 'srand(2); print "#{rand}\t#{rand}\t#{rand}\n"'
0.435994902142004 0.0259262318278913 0.549662477878709
> ruby -e 'srand(2); print "#{rand}\t#{rand}\t#{rand}\n"'
0.435994902142004 0.0259262318278913 0.549662477878709

> ruby -v
ruby 1.8.4 (2005-12-24) [i586-linux]

3 Answers

David Johnston

1/5/2012 7:12:00 AM

0

On 1/4/2012 8:58 PM, anim8rfsk wrote:

>> See, that's funny, because I feel the opposite - the season premiere had
>> actually plot *movement*. So I don't feel this show is 'stringing us
>> along' right now, at all...
>
> Uh, given that they promised us As identity, and didn't come through?
>

I don't recall them ever promising that A would be revealed in that
episode.

icebreaker

1/5/2012 2:24:00 PM

0


"Ian J. Ball" <ijball@mac.com> wrote in message
news:3ec25463-c58b-4e38-9af3-c4a339447fc3@l24g2000yqm.googlegroups.com...
> On Jan 4, 7:58 pm, anim8rfsk <anim8r...@cox.net> wrote:
>> "Ian J. Ball" <ijball-NO_S...@mac.invalid> wrote:
>> > In article <jdvjg6$ie...@dont-email.me>,
>> > "Icebreaker" <icebrea...@nowheres.com> wrote:
>> >> "Ian J. Ball" <ijball-NO_S...@mac.invalid> wrote in message
>> >>news:ijball-NO_SPAM-E9853C.08082603012012@news.eternal-september.org...
>>
>> >>> Then I watched the two premieres:
>>
>> >>> Pretty Little Liars - This was very, very good, I thought. Even
>> >>> though I
>> >>> figured out the 'twist'/gambit in the first couple of scenes, the
>> >>> plot
>> >>> still advanced in major ways in this one, and things actually
>> >>> "happened". The awkward absences of Jenna (especially - who kept
>> >>> being
>> >>> referred as being basically "just off-camera"!...), Jason
>> >>> DiLaurentis,
>> >>> Emily's parents, Melissa and the Hastings parents, and even Mona, was
>> >>> unappreciated, but probably unavoidable with this show.
>> >>> Anyway, when Ezra finally told Aria's parents, I nearly peed my
>> >>> pants
>> >>> it was so LOL *awkward* - really good face and body acting from Holly
>> >>> Marie Combs in that scene!
>> >>> The one thing I'm not looking forward to is the return of Hanna's
>> >>> dad's new wife and step-daughter - I guess now that AMC is
>> >>> over-and-done
>> >>> with, we're going to be stuck with Natalie Hall's Kate
>> >>> semi-full-time...
>> >>> :(
>> >>> But, thumbs up on this one.
>>
>> >> The coming return of Dad and the evil stepsister was the last nail for
>> >> me.
>> >> This show for all the scheming and plotting never moves forward, and
>> >> the "A"
>> >> conspirators always gets off scot-free.
>>
>> > See, that's funny, because I feel the opposite - the season premiere
>> > had
>> > actually plot *movement*. So I don't feel this show is 'stringing us
>> > along' right now, at all...
>>
>> Uh, given that they promised us As identity, and didn't come through?
>
> They did *not* promise A's identity IN THE FIRST EPISODE - they only
> promised A's identity BY THE END OF THE CURRENT SEASON.
>
> And, in fact, the premiere got us closer to that very thing.

In what way? Do you think they are going to take a linear, step-by-step path
to the revelation? I think they are fooling around with the viewer and will
until they make a reveal, and I'm thinking the reveal will end up being a
cheat for the most part.

Ian J. Ball

1/5/2012 3:43:00 PM

0

In article <je4bq6$n59$1@dont-email.me>,
"Icebreaker" <icebreaker@nowheres.com> wrote:

> "Ian J. Ball" <ijball@mac.com> wrote in message
> news:3ec25463-c58b-4e38-9af3-c4a339447fc3@l24g2000yqm.googlegroups.com...
> > On Jan 4, 7:58 pm, anim8rfsk <anim8r...@cox.net> wrote:
> >>
> >> Uh, given that they promised us As identity, and didn't come through?
> >
> > They did *not* promise A's identity IN THE FIRST EPISODE - they only
> > promised A's identity BY THE END OF THE CURRENT SEASON.
> >
> > And, in fact, the premiere got us closer to that very thing.
>
> In what way? Do you think they are going to take a linear, step-by-step path
> to the revelation? I think they are fooling around with the viewer and will
> until they make a reveal, and I'm thinking the reveal will end up being a
> cheat for the most part.

Could be. We'll see. But I'm not going to assume that until I actually
see them pull it...

--
"I'm untouchable, bitch." - Rob Lowe as Drew Peterson,
in "Drew Peterson: Untouchable", on Lifetime, 01/21/11