summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2019-08-30 20:32:02 -0600
committerAaron Ball <nullspoon@oper.io>2019-08-30 20:34:13 -0600
commit861070c2fd4fccfae91c758e110d061e4bb57bf2 (patch)
tree537e542a499047084a5775d7c13defff861a7f44 /src
parent1dd4ef2a85c17fa59243a16f5b4680b6f00b8644 (diff)
downloadupwgen-861070c2fd4fccfae91c758e110d061e4bb57bf2.tar.gz
upwgen-861070c2fd4fccfae91c758e110d061e4bb57bf2.tar.xz
Streamline random selection code in main
Diffstat (limited to 'src')
-rw-r--r--src/main.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/main.c b/src/main.c
index 50d55b9..a625288 100644
--- a/src/main.c
+++ b/src/main.c
@@ -156,23 +156,20 @@ int main(int argc, char* argv[]) {
srand((unsigned)seed);
cursor = set;
- while(len > 0) {
- // Randomly select the number of character sets to advance through (max 10)
+ while((len--) > 0) {
+ // Randomly select the number of character sets to advance through
int i = rand() % 10;
- while(i > 0) {
+ while((i--) > 0) {
// Loop
- if(!cursor->next) {
+ if(!cursor->next)
cursor = set;
- } else {
+ else
cursor = cursor->next;
- }
- i--;
}
// Randomly select an integer within the set size
int rc = rand() % cursor->count; // Random char within set
printf("%lc", cursor->chars[rc]);
- len--;
}
printf("\n");

Generated by cgit