comparison src/main/kotlin/name/blackcap/passman/Generate.kt @ 8:698c4a3d758d

Some code clean-up.
author David Barts <n5jrn@me.com>
date Fri, 23 Sep 2022 20:59:52 -0700
parents a6cfdffcaa94
children
comparison
equal deleted inserted replaced
7:f245b9a53495 8:698c4a3d758d
42 while (i < length) { 42 while (i < length) {
43 generated[i++] = randomized(passchars, randomizer) 43 generated[i++] = randomized(passchars, randomizer)
44 } 44 }
45 45
46 /* scramble them */ 46 /* scramble them */
47 for (i in 0 until length) { 47 for (j in 0 until length) {
48 val j = randomizer.nextInt(length) 48 val k = randomizer.nextInt(length)
49 if (i != j) { 49 if (j != k) {
50 val temp = generated[i] 50 val temp = generated[j]
51 generated[i] = generated[j] 51 generated[j] = generated[k]
52 generated[j] = temp 52 generated[k] = temp
53 } 53 }
54 } 54 }
55 55
56 /* AMF... */ 56 /* AMF... */
57 return generated 57 return generated