I want to generate 16 digit random number (EndToEndId) in ECMAScript in series. I have written below function but it generates any random number. For example, it generated 8031241688371482 but I want to get second random number ((EndToEndId1))as 8031241688371483. I am using Rational Integration Tester (RIT) tool. So, tags is used in RIT but you can neglect it for now.
I want to use random number to enter as a EndToEndId to send in PAIN001 file for transaction.
Thank you.
var arr_names = new Array(3)
var randomNumber
var len
function GenerateNumber(){
randomNumber = Math.round(Math.random()*10000000000000000).toFixed(0)
len = randomNumber.toString().length
}
for(var i = 0;i<arr_names.length;i++) {
randomNumber = Math.round(Math.random()*10000000000000000).toFixed(0)
len = randomNumber.toString().length
while(len != 16){
GenerateNumber()
}
arr_names[i] = randomNumber
}
tags["EndToEndId"] = arr_names[0];
tags["EndToEndId1"] = arr_names[1];
tags["EndToEndId2"] = arr_names[2];
Aucun commentaire:
Enregistrer un commentaire