On Jun 20, 10:58 pm, Cameron Simpson wrote:
> On 20Jun2010 12:44, Stefan Behnel wrote:
> | southof40, 20.06.2010 12:19:
> | >I have list of of N Vehicle objects - the only possible vehicles are
> | >cars, bikes, trucks.
> | >
> | >I want to select an object from the list with a probability of : c
On Jun 20, 11:27 pm, Mel wrote:
> southof40 wrote:
> > I have list of of N Vehicle objects - the only possible vehicles are
> > cars, bikes, trucks.
>
> > I want to select an object from the list with a probability of : cars
> > 0.7, bikes 0.3, trucks 0.1.
>
> > I've currently implemented this by
On Jun 20, 10:55 pm, Rob Williscroft wrote:
> southof40 wrote in news:da3cc892-b6dd-4b37-a6e6-
> b606ef967...@t26g2000prt.googlegroups.com in gmane.comp.python.general:
>
> > I have list of of N Vehicle objects - the only possible vehicles are
> > cars, bikes, trucks.
>
> > I want to select an obj
On Jun 20, 10:53 pm, Steven D'Aprano wrote:
> On Sun, 20 Jun 2010 03:19:55 -0700, southof40 wrote:
> > I have list of of N Vehicle objects - the only possible vehicles are
> > cars, bikes, trucks.
>
> > I want to select an object from the list with a probability of : cars
> > 0.7, bikes 0.3, truck
Oh yes as several have pointed out there was a typo in my original
question ... I can only blame 'toolongatscreenitis' !
--
http://mail.python.org/mailman/listinfo/python-list
Thanks to everybody ... as usual on c.l.p I'm blown away by the
knowledge and skills ! I've added some replies/clarifications to other
posts but thanks again to you all.
--
http://mail.python.org/mailman/listinfo/python-list
duncan smith wrote:
southof40 wrote:
I have list of of N Vehicle objects - the only possible vehicles are
cars, bikes, trucks.
I want to select an object from the list with a probability of : cars
0.7, bikes 0.3, trucks 0.1.
I've currently implemented this by creating another list in which eac
southof40 wrote:
I have list of of N Vehicle objects - the only possible vehicles are
cars, bikes, trucks.
I want to select an object from the list with a probability of : cars
0.7, bikes 0.3, trucks 0.1.
I've currently implemented this by creating another list in which each
car object from the
southof40 writes:
> I want to select an object from the list with a probability of : cars
> 0.7, bikes 0.3, trucks 0.1.
You can do it with one pass through the list using a well-known online
algorithm (I don't remember what it's called). Untested code:
import random
tprob = 0 # total prob
On Sun, 20 Jun 2010 11:27:30 +, Mel wrote:
> southof40 wrote:
>
>> I have list of of N Vehicle objects - the only possible vehicles are
>> cars, bikes, trucks.
>>
>> I want to select an object from the list with a probability of : cars
>> 0.7, bikes 0.3, trucks 0.1.
>>
>> I've currently imple
On Sun, 20 Jun 2010 03:19:55 -0700, southof40 wrote:
> I want to select an object from the list with a probability of : cars
> 0.7, bikes 0.3, trucks 0.1.
>
> I've currently implemented this by creating another list in which each
> car object from the original list appears 7 times, each bike 3 ti
southof40 wrote:
> I have list of of N Vehicle objects - the only possible vehicles are
> cars, bikes, trucks.
>
> I want to select an object from the list with a probability of : cars
> 0.7, bikes 0.3, trucks 0.1.
>
> I've currently implemented this by creating another list in which each
> car ob
On 20Jun2010 12:44, Stefan Behnel wrote:
| southof40, 20.06.2010 12:19:
| >I have list of of N Vehicle objects - the only possible vehicles are
| >cars, bikes, trucks.
| >
| >I want to select an object from the list with a probability of : cars
| >0.7, bikes 0.3, trucks 0.1.
| >
| >I've currently
southof40 wrote in news:da3cc892-b6dd-4b37-a6e6-
b606ef967...@t26g2000prt.googlegroups.com in gmane.comp.python.general:
> I have list of of N Vehicle objects - the only possible vehicles are
> cars, bikes, trucks.
>
> I want to select an object from the list with a probability of : cars
> 0.7, b
On Sun, 20 Jun 2010 03:19:55 -0700, southof40 wrote:
> I have list of of N Vehicle objects - the only possible vehicles are
> cars, bikes, trucks.
>
> I want to select an object from the list with a probability of : cars
> 0.7, bikes 0.3, trucks 0.1.
That adds to a probability of 1.1, which is i
southof40, 20.06.2010 12:19:
I have list of of N Vehicle objects - the only possible vehicles are
cars, bikes, trucks.
I want to select an object from the list with a probability of : cars
0.7, bikes 0.3, trucks 0.1.
I've currently implemented this by creating another list in which each
car obj
16 matches
Mail list logo