Random Instance generation

Larry Bates lbates at swamisoft.com
Tue Sep 14 19:28:27 EDT 2004


I don't know what you mean by "random" but one
solution is:

a=[]
a=[A() for n in range(0,100)]

They are a[0], a[1], a[2} and don't resemble
anything like "randomness", but there are 100
of them stored in the list a.

Larry Bates

"Balaji" <balaji at email.arizona.edu> wrote in message
news:494182a9.0409141247.608d365f at posting.google.com...
> Hello eveybody....
>
> Suppose there is a class A:
>
> I want to generate say 100 random instance of it...
>
> How can I do that....
>
> I want the instance name to be like a1, a2, a3...
>
> Any ideas.....
>
> Cheers
>
> Balaji





More information about the Python-list mailing list