given a list L, with all values are numbers, randomly pick an item and return it's index according to the percentage of all values
(L)
| 68 | |
| 69 | #======================================================================== |
| 70 | def randomPickList(L): |
| 71 | ''' given a list L, with all values are numbers, |
| 72 | randomly pick an item and return it's index according |
| 73 | to the percentage of all values''' |
| 74 | |
| 75 | return findIndex(accumList(L,1), random.random()) |
| 76 | |
| 77 | #======================================================================== |
| 78 | def deepList(LString): |