public string GenerateCardTokenOptimised()
{
int[] checkArray = new int[15];
var cardNum = new int[16];
for (int d = 14; d >= 0; d--)
{
cardNum[d] = _random.Next(0, 9);
checkArray[d] = ( cardNum[d] * (((d+1)%2)+1)) % 9;
}
cardNum[15] = ( checkArray.Sum() * 9 ) % 10;
var sb = new StringBuilder();
for (int d = 0; d < 16; d++)
{
sb.Append(cardNum[d].ToString());
}
return sb.ToString();
}
It seems Rexx does not have the usual arrays in other languages so how can I implement this
Rexx has stem variables. Stem variables are Associate arrays like Map<String, String> in Java and are used instead of arrays.
You can do
you can also use strings as key in stem variables
You can also check if something is found