This is a simple RandomStringGenerator based on the 52 factorial principle.
This program will generate a string of 51 characters (from A to Z and a to z). Some characters might repeat 1 time randomly, this is all to ensure randomness and minimize repetitions.
It has been converted to a pseudo RNG in Nox_RTD
This program is not supposed to print the same string twice, yet sometimes it does, you can appreciate this in the SAMPLE_OUTPUT file, 2 strings repeated in a series of 1050 strings. The first string at line @480, with it's doppleganger @785 and the second line @374, it's doppleganger @552.
I noticed the logic error causing this issue months ago, but honestly I do not feel like fixing it for now.
You will need an instance of Nox_Aux_Functions.c for this to work well. (Should be included in the source file)
#include "nox.h"
char *Nox_Random(void);
/**
* main - entry point for the program
*
* Return: always 0;
*/
int main()
{
char *ptr;
int i, b;
b = 72;
while (b > 0)
{
ptr = Nox_Random();
for(i = 0; i < 51; i++)
putchar(ptr[i]);
putchar('\n');
b--;
free(ptr);
}
printf("\nThere we go, i'm done.\nPress any key to exit.");
getchar();
return (0);
}
If you want to try it out yourself, you can download the full project below:
Download Nox_RSGTo compile it, just unzip the whole folder and do a "gcc *.c" on it, no dependencies.
It works best on linux, if you need to run it in windows use WSL or another emulator. It can work in windows but it will screw the RNG.