Not Java/(-script) nor cmd but a PowerShell script :
$InFile = 'x.txt'
$Search = [regex]' K(?<Base>\d+) (?<Max>\d+) (?<Min>\d+)'
(get-content $InFile -raw) -split("&")|
ForEach{
if ($_ -match $Search){
[int]$Min = [math]::min($matches.Min,$matches.Max)
[int]$Max = [math]::max($matches.Min,$matches.Max)
$AddRand = [int]$(Get-Random -min $Min -max $Max)
"Base {0,6} Min {1,6} Max {2,6} AddRand {3,4} Result {4,6}" -f $matches.Base,
$Min,$Max,$AddRand,[int]([int]$matches.Base + $AddRand)
}
}
Output stays the same after edit.
Base 29275 Min 00125 Max 01888 AddRand 132 Result 29407
Base 2422 Min 00122 Max 001838 AddRand 772 Result 3194
Base 07581 Min 00136 Max 02051 AddRand 1786 Result 9367
Except for the proper evaluation of min and max the script is the same