You are correct that you are only generating the random number on page load, because you define t right when the page loads. What you need to do is generate the number inside the click function, so that way
var t = Math.floor(Math.random() * 256);
is called every time you click instead of just once when the document is ready.
So instead of
$("#add_row").click(function(){
$('#addr'+i).html("<td>"+ (i+1) +"</td><td><input name='need["+t+"][type]' type='text' placeholder='Name' class='form-control input-md' /> </td><td><input name='need["+t+"][scope]' type='text' placeholder='Mail' class='form-control input-md'></td><td><input name='need["+t+"][priority]' type='text' placeholder='Mobile' class='form-control input-md'></td>");
$('#tab_logic').append('<tr id="addr'+(i+1)+'"></tr>');
i++;
});
you would have:
$("#add_row").click(function(){
var t = Math.floor(Math.random() * 256);
$('#addr'+i).html("<td>"+ (i+1) +"</td><td><input name='need["+t+"][type]' type='text' placeholder='Name' class='form-control input-md' /> </td><td><input name='need["+t+"][scope]' type='text' placeholder='Mail' class='form-control input-md'></td><td><input name='need["+t+"][priority]' type='text' placeholder='Mobile' class='form-control input-md'></td>");
$('#tab_logic').append('<tr id="addr'+(i+1)+'"></tr>');
i++;
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…