# An interesting one-liner to ponder

**URL:** <https://www.ruby-forum.com/t/an-interesting-one-liner-to-ponder/120454>\
**Category:** Ruby\
**Created:** [November 17, 2007, 2:17am UTC](https://www.ruby-forum.com/t/an-interesting-one-liner-to-ponder/120454 "2007-11-17T02:17:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [November 17, 2007, 2:17am UTC](https://www.ruby-forum.com/t/an-interesting-one-liner-to-ponder/120454/1 "2007-11-17T02:17:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [November 17, 2007, 5:27pm UTC](https://www.ruby-forum.com/t/an-interesting-one-liner-to-ponder/120454/2 "2007-11-17T17:27:09Z")

</div>

2007/11/17, John J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 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
