enter code here
How do i randomly select more than one item from a list in linux scripting ?
For example:-
Column A Column B
Itemcode Quantity
COM#004 2
COM#005 3
COME001 10
COMT000 3
COMT001 3
COMH000 1
COMH000 1
COM#006 2
CT100H000 1
Inputs:- the number of item to select
for example :- the number of item to select = 6
COME001
COMT000
COM#004
COM#006
COMT001
COMH000
after an set of items been selected, quatity has to be reduced. should be able to pick item for next select till its quantity gets zero.
It works but I wanted the stock to be maintained for example. on the output 1:- COME001 is picked and stock shows as 9 but on output 2 it has not been picked that's ok its picks randomly but stock should be maintained as 9 instead of 10
Output 1:- $ python test.py Picked: ['COM#004', 'COM#005', 'COMH000', 'COM#004', 'CT100H000', 'COME001']
Stock left COMH000 1 COMT000 3 COMT001 3 CT100H000 0 COM#005 2 COM#004 0 COM#006 2 COME001 9
Output 2:- $ python test.py Picked: ['COMH000', 'COMT000', 'COM#004', 'COM#006', 'COM#005', 'COMH000']
Stock left COMH000 0 COMT000 2 COMT001 3 CT100H000 1 COM#005 2 COM#004 1 COM#006 1 COME001 10