[chef] Re: how to generate a random integer in a template.erb file


Chronological Thread 
  • From: Daniel Condomitti < >
  • To:
  • Subject: [chef] Re: how to generate a random integer in a template.erb file
  • Date: Wed, 13 Feb 2013 10:44:15 -0800

http://www.ruby-doc.org/core-1.9.3/Random.html

Random.rand(10000)

This will cause the template to be rendered every time chef runs though (along with sending notifications) so I wouldn't recommend doing it unless that's the exact behavior you're looking for.

On Wednesday, February 13, 2013 at 10:41 AM, David Montgomery wrote:

Hi,

I am not a ruby expert but in a template I need to generate a random integer e.g. between 0 and 10000.

How would I do that?

thanks




Archive powered by MHonArc 2.6.16.

§