Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Set minimum for random number generator
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
OrganicFreeStyle  
View profile  
 More options Jun 11 2006, 11:54 am
Newsgroups: comp.lang.ruby
From: "OrganicFreeStyle" <digitalorgan...@gmail.com>
Date: 11 Jun 2006 08:54:16 -0700
Local: Sun, Jun 11 2006 11:54 am
Subject: Set minimum for random number generator
Hi all. I'm programming a model of economic relationships in both
python and ruby near simultaneously, and as with most simulations, I
need to generate a random number within a specific range. I'm a python
man, and in python you can call random.randint(min, max) to achieve
this. Rand allows you to set the max, but what about the min? Is there
a similar method to Python's randint() in Ruby? Alternative random
number generators that have this ability? Thanks.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ZeD  
View profile  
(1 user)  More options Jun 11 2006, 12:14 pm
Newsgroups: comp.lang.ruby
From: ZeD <vito.detul...@gmail.com>
Date: Sun, 11 Jun 2006 16:14:33 GMT
Local: Sun, Jun 11 2006 12:14 pm
Subject: Re: Set minimum for random number generator

OrganicFreeStyle wrote:
> Hi all. I'm programming a model of economic relationships in both
> python and ruby near simultaneously, and as with most simulations, I
> need to generate a random number within a specific range. I'm a python
> man, and in python you can call random.randint(min, max) to achieve
> this. Rand allows you to set the max, but what about the min? Is there
> a similar method to Python's randint() in Ruby? Alternative random
> number generators that have this ability? Thanks.

from a non-ruby developer :)

min + rand (max-min)

--
Under construction


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
OrganicFreeStyle  
View profile  
 More options Jun 11 2006, 12:29 pm
Newsgroups: comp.lang.ruby
From: "OrganicFreeStyle" <digitalorgan...@gmail.com>
Date: 11 Jun 2006 09:29:37 -0700
Local: Sun, Jun 11 2006 12:29 pm
Subject: Re: Set minimum for random number generator

Brilliant. Such elegance! Thank you ZeD, much appreciated.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Serendipity  
View profile  
 More options Jun 27 2006, 2:14 am
Newsgroups: comp.lang.ruby
From: "Serendipity" <katash...@gmail.com>
Date: 26 Jun 2006 23:14:46 -0700
Local: Tues, Jun 27 2006 2:14 am
Subject: Re: Set minimum for random number generator

> min + rand (max-min)

Just what I was looking for...thanks!

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google