Random Number Generation?

2005-12-11 Thread Dimos
Hello All,

I need some help with random number generation. What I
need exactly is:

To create a few thousand numbers, decimal and
integers, between 5 and 90, 
and then to export them as a single column at a
spreadsheet.

I am newbie, I was not able to create decimals with
the random modules of 
Python 2.3.

Thanks, Dimos 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


Weibull distr. random number generation

2010-11-20 Thread Dimos
Dear Python list subscribers,

Sorry of this has been covered already...This is a newbie question about actual 
scripting/syntax.

I would like to use the random module, and if I understand well the Random 
class, to create  1300 decimal numbers in python, by providing the 2 Weibull 
parameters (b,c). How this can be done???

import random
print random
random.weibullvariate(b,c)
How can I set the population size n=1300 in decimals?

Best, Dimos





  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Weibull distr. random number generation

2010-11-22 Thread Dimos
Hello Mark,

Exactly, thanks very much!

Dimos

--- On Sat, 11/20/10, Mark Dickinson  wrote:

> From: Mark Dickinson 
> Subject: Re: Weibull distr. random number generation
> To: [email protected]
> Date: Saturday, November 20, 2010, 7:09 PM
> On Nov 19, 3:21 pm, Dimos 
> wrote:
> > I would like to use the random module, and if I
> understand well the Random class, to create  1300 decimal
> numbers in python, by providing the 2 Weibull parameters
> (b,c). How this can be done???
> >
> > import random
> > print random
> > random.weibullvariate(b,c)
> > How can I set the population size n=1300 in decimals?
> 
> random.weibullvariate(b, c) generates a single sample from
> the
> specified Weibull distribution.  If you want 1300
> samples, you'd use
> this within a loop.  For example, here's code to put
> 10 Weibull
> variates with scale parameter 12345.0 and shape parameter
> 6.0 into a
> list:
> 
> >>> import random
> >>> samples = []
> >>> for i in xrange(10):
> ... 
>    samples.append(random.weibullvariate(12345.0,
> 6.0))
> ...
> >>> print samples
> [15553.186762792948, 14304.175032317309,
> 9015.5053691933044,
> 12585.469181732506, 9436.2677219460638, 13350.89758791281,
> 5687.4330250037565, 12172.747202474553,
> 9687.8685933610814,
> 11699.040541029028]
> 
> A more experienced Python programmer might use a list
> comprehension to
> achieve the same effect in a single line:
> 
> >>> samples = [random.weibullvariate(12345.0, 6.0)
> for _ in xrange(10)]
> >>> print samples
> [10355.396846416865, 14689.507803932587,
> 11491.850991569485,
> 14128.56397290655, 12592.739991974759, 9076.7752548878998,
> 11868.012238422616, 12016.784656753523,
> 14724.818462506191,
> 13253.477389116439]
> 
> Is this the sort of thing you were looking for?
> 
> --
> Mark
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 


  
-- 
http://mail.python.org/mailman/listinfo/python-list