On Sep 28, 5:22 pm, "Aaron \"Castironpi\" Brady"
<[EMAIL PROTECTED]> wrote:
> On Sep 28, 4:08 pm, Michael Ströder <[EMAIL PROTECTED]> wrote:
>
>
>
> > Gary M. Josack wrote:
> > > Aaron "Castironpi" Brady wrote:
> > >> On Sep 28, 2:59 pm, sotirac <[EMAIL PROTECTED]> wrote:
>
> > >>> Wondering if the
On Sep 29, 12:06 am, Mensanator <[EMAIL PROTECTED]> wrote:
> On Sep 28, 3:54 pm, "Aaron \"Castironpi\" Brady"
>
>
>
>
>
> <[EMAIL PROTECTED]> wrote:
> > On Sep 28, 3:44 pm, Mensanator <[EMAIL PROTECTED]> wrote:
>
> > > On Sep 28, 3:11 pm, "Gary M. Josack" <[EMAIL PROTECTED]> wrote:
>
> > > > Chris
Tim Chase:
> I suspect that the zfill responses don't have the property of equally
> distributed "randomness", as the first digit may more likely be a zero.
This code I have shown before:
str(randrange(10)).zfill(5)
If the numbers are equally distributed in [0, 9], then the leading
zeros
On Sep 28, 4:02�pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > Wondering if there is a better way to generate string of numbers with
> > a length of 5 which also can have a 0 in the front of the number.
>
> If you want to resample the same digit multiple times, either of these
> two will do:
>
> �>>>
On Sep 28, 3:54�pm, "Aaron \"Castironpi\" Brady"
<[EMAIL PROTECTED]> wrote:
> On Sep 28, 3:44�pm, Mensanator <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > On Sep 28, 3:11 pm, "Gary M. Josack" <[EMAIL PROTECTED]> wrote:
>
> > > Chris Rebert wrote:
> > > > On Sun, Sep 28, 2008 at 12:59 PM, sotirac <[EMAIL
On Sep 28, 4:08 pm, Michael Ströder <[EMAIL PROTECTED]> wrote:
> Gary M. Josack wrote:
> > Aaron "Castironpi" Brady wrote:
> >> On Sep 28, 2:59 pm, sotirac <[EMAIL PROTECTED]> wrote:
>
> >>> Wondering if there is a better way to generate string of numbers with
> >>> a length of 5 which also can hav
Gary M. Josack wrote:
> Aaron "Castironpi" Brady wrote:
>> On Sep 28, 2:59 pm, sotirac <[EMAIL PROTECTED]> wrote:
>>
>>> Wondering if there is a better way to generate string of numbers with
>>> a length of 5 which also can have a 0 in the front of the number.
>>>
>>>
>>> random_number = random
Wondering if there is a better way to generate string of numbers with
a length of 5 which also can have a 0 in the front of the number.
If you want to resample the same digit multiple times, either of these
two will do:
>>> from random import choice
>>> ''.join(str(choice(range(10))) for _ in
On Sep 28, 3:44 pm, Mensanator <[EMAIL PROTECTED]> wrote:
> On Sep 28, 3:11 pm, "Gary M. Josack" <[EMAIL PROTECTED]> wrote:
>
>
>
> > Chris Rebert wrote:
> > > On Sun, Sep 28, 2008 at 12:59 PM, sotirac <[EMAIL PROTECTED]> wrote:
>
> > >> Wondering if there is a better way to generate string of numb
On Sep 28, 3:11�pm, "Gary M. Josack" <[EMAIL PROTECTED]> wrote:
> Chris Rebert wrote:
> > On Sun, Sep 28, 2008 at 12:59 PM, sotirac <[EMAIL PROTECTED]> wrote:
>
> >> Wondering if there is a better way to generate string of numbers with
> >> a length of 5 which also can have a 0 in the front of the
Gary M. Josack wrote:
Aaron "Castironpi" Brady wrote:
On Sep 28, 2:59 pm, sotirac <[EMAIL PROTECTED]> wrote:
Wondering if there is a better way to generate string of numbers with
a length of 5 which also can have a 0 in the front of the number.
random_number = random.sample([0,1,2,3,4,5,6,
sotirac:
> random_number = random.sample([0,1,2,3,4,5,6,7,8,9], 5) # choose 5 elements
But note that's without replacement. So if you want really random
numbers you can do this:
>>> from string import digits
>>> from random import choice
>>> "".join(choice(digits) for d in xrange(5))
'93898'
If
Aaron "Castironpi" Brady wrote:
On Sep 28, 2:59 pm, sotirac <[EMAIL PROTECTED]> wrote:
Wondering if there is a better way to generate string of numbers with
a length of 5 which also can have a 0 in the front of the number.
random_number = random.sample([0,1,2,3,4,5,6,7,8,9], 5) # choose 5
Chris Rebert wrote:
On Sun, Sep 28, 2008 at 12:59 PM, sotirac <[EMAIL PROTECTED]> wrote:
Wondering if there is a better way to generate string of numbers with
a length of 5 which also can have a 0 in the front of the number.
random_number = random.sample([0,1,2,3,4,5,6,7,8,9], 5) # choose
On Sep 28, 2:59 pm, sotirac <[EMAIL PROTECTED]> wrote:
> Wondering if there is a better way to generate string of numbers with
> a length of 5 which also can have a 0 in the front of the number.
>
>
> random_number = random.sample([0,1,2,3,4,5,6,7,8,9], 5) # choose 5
> elements
> code = 'this is
On Sun, Sep 28, 2008 at 12:59 PM, sotirac <[EMAIL PROTECTED]> wrote:
> Wondering if there is a better way to generate string of numbers with
> a length of 5 which also can have a 0 in the front of the number.
>
>
>
> random_number = random.sample([0,1,2,3,4,5,6,7,8,9], 5) # choose 5
> elements
>
Wondering if there is a better way to generate string of numbers with
a length of 5 which also can have a 0 in the front of the number.
random_number = random.sample([0,1,2,3,4,5,6,7,8,9], 5) # choose 5
elements
code = 'this is a string' + str(random_number[0]) +
str(random_number[1]) + str(ra
17 matches
Mail list logo