Develop a tool in excel/Python or Java

Job ID: 36091995

Budget: $30 – $60 USD

I need some one who can help me by creating a function that can populate randomly cell values till the sum of all this values is equal to a given value. The random values depends on another value, the idea is to determinate when this random value can be 1 or 2 or 3 or 4 or 0 so at the end , the sum is equal to another given value.