an interesting one-liner to ponder

J

John Joyce

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.
 
R

Robert Klemme

2007/11/17 said:
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
 

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

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top