Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > an interesting one-liner to ponder

Reply
Thread Tools

an interesting one-liner to ponder

 
 
John Joyce
Guest
Posts: n/a
 
      11-17-2007
Here's an interesting one-liner to ponder.

0.step(100, rand) { |x| puts x }

Think of timers, for games or whatever, you could easily alter the
pseudo-random stepping increment to make it bigger but random, or
have broader ranges of randomness.

The interval will not be obvious to the user.


 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      11-17-2007
2007/11/17, John Joyce <(E-Mail Removed)>:
> Here's an interesting one-liner to ponder.
>
> 0.step(100, rand) { |x| puts x }
>
> Think of timers, for games or whatever, you could easily alter the
> pseudo-random stepping increment to make it bigger but random, or
> have broader ranges of randomness.
>
> The interval will not be obvious to the user.


But constant. I am not sure I understand what this is good for. Can
you share your ideas?

Kind regards

robert


--
use.inject do |as, often| as.you_can - without end

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ten thoughts to ponder Meat Plow Computer Support 3 11-03-2010 01:53 AM
Question To Ponder Lawrence D'Oliveiro NZ Computing 4 05-30-2009 02:12 AM
Ponder This? argyliz Computer Support 2 11-09-2008 09:15 PM
OT: Something to ponder BratŪ MCSE 50 07-09-2004 06:59 PM
Ponder points. "code behind" framework Girish ASP .Net 1 01-23-2004 07:13 PM



Advertisments