Nox RollTheDice (RTD)

This is a dice roller built atop Nox_RSG, it will pick random characters from a random string and try to come up with a random number. It is just a simple demonstration on how to transform RSG into a dice roller, and it is not meant to be a full program by itself.

Currently it is rolling a 50-sided dice, you can modify this by changing the ptr = Nox_RTD(50) value, just change the '50' for the number of dice faces. I would advise against running something other than a 100-sided dice in this version.

The number generated by the program is not actually a number between 1 and 50, but rather a random number created from the value of the ASCII characters picked. As such, you will probably never get certain numbers.

Code Snippet (main.c)


#include "nox.h"
#include 
char *Nox_Random(void);
int Nox_RTD(int);
/**
 * main - entry point for the program
 *
 * Return: always 0;
 */
int main()
{
    int ptr;
    int i;

    while(1)
      {
        ptr = Nox_RTD(100);

        printf("Roll: %d", ptr);

        getchar();
      }

    return (0);
}
        

Download

If you want to try it out yourself, you can download the full project below:

Download Nox_RTD

To 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.



Back to projects