I have to create a random 16x16 array filled so that the sum of the entire flattened array is 500 (e.g. the sum I'd need for the array {{0,0,1,0},{1,2,1,2},{0,0,0,0},{3,0,1,0}} is 11).
I'd like also to use only integer numbers in range form 0 to 5.
{{0,0,1,0},{1,2,1,2},{0,1,3,0},{0,0,0,0}}the sum I'd need is 11). Sorry if I couldn't explain properly. – Riccardo Cazzin Feb 22 '17 at 18:26# (35000/Total[#, 2]) & @ RandomReal[{0, 1}, {16, 16}]– Mr.Wizard Feb 22 '17 at 18:49