jeudi 25 juin 2020

Powershell: generate unique semi random numeric strings

Requirement: generate 10k of unique numbers composed of a sequential number (16 digits) followed by a random numeric string (4 digits). Weapon of choice is Powershell because it's the only tool I have a very limited knowledge of.

Problems encountered:

  1. Generating 10k sequential numbers using the following method: 1400000000000000..1400000000010000 and putting into a variable. Error: Value is to large for an Int32
  2. Generating 10k of 4 digit via Get-Random -Minimum 0001 -Maximum 9999 and putting them in a variable. I manage only to obtain 1 random number.
  3. Combining the two variables using the Join-Object (or at least that's what I hope could be done)

How can I combine these 3 commands to obtain a list of semi random numbers as specified above? Or is there simpler way to achieve the same result?




Aucun commentaire:

Enregistrer un commentaire