Re: Weighted "random" selection from list of lists

2005-10-09 Thread Steven D'Aprano
On Sat, 08 Oct 2005 12:48:26 -0400, Jesse Noller wrote: > Once main_list is populated, I want to build a sequence from items > within the lists, "randomly" with a defined percentage of the sequence > coming for the various lists. For example, if I want a 6 item > sequence, I might want: > > 60% f

Re: Weighted "random" selection from list of lists

2005-10-08 Thread Scott David Daniels
Jesse Noller wrote: > Once main_list is populated, I want to build a sequence from items > within the lists, "randomly" with a defined percentage of the sequence > coming for the various lists. For example: > 60% from list 1 (main_list[0]), 30% from list 2 (main_list[1]), 10% from list > 3 (main_

Re: Weighted "random" selection from list of lists

2005-10-08 Thread Peter Otten
Jesse Noller wrote: > I'm probably missing something here, but I have a problem where I am > populating a list of lists like this: > > list1 = [ 'a', 'b', 'c' ] > list2 = [ 'dog', 'cat', 'panda' ] > list3 = [ 'blue', 'red', 'green' ] > > main_list = [ list1, list2, list3 ] > > Once main_list is

Re: Weighted "random" selection from list of lists

2005-10-08 Thread Ron Adam
Jesse Noller wrote: > 60% from list 1 (main_list[0]) > 30% from list 2 (main_list[1]) > 10% from list 3 (main_list[2]) > > I know how to pull a random sequence (using random()) from the lists, > but I'm not sure how to pick it with the desired percentages. > > Any help is appreciated, thanks >

Weighted "random" selection from list of lists

2005-10-08 Thread Jesse Noller
Hello - I'm probably missing something here, but I have a problem where I am populating a list of lists like this: list1 = [ 'a', 'b', 'c' ] list2 = [ 'dog', 'cat', 'panda' ] list3 = [ 'blue', 'red', 'green' ] main_list = [ list1, list2, list3 ] Once main_list is populated, I want to build a se