vendredi 6 janvier 2017

Experimenting with Random Number Generation

I'm looking for information on how to generate a calculation with the following conditions:

  1. the module must be ran using HTML and Java Script,
  2. the module must get the current date and time as integers,
  3. the module needs to calculate the generated numbers to get a 1 or 2 digit integer after the calculation is complete,
  4. and the date and time must have the following conditions;
    • the date must be divided into separate numbers for year, month, and day
    • and the time must divided into separate numbers for hour, minute, second, and millisecond

Each number will either be 2 digits or 4 digits long. For example:

The module is to be written in HTML and Java Script.

I call for date and time to get int day as dd, int month as mm, int year as yyyy, int hour as hh, int minute as mm, int second as ss, and int millisecond as ssss.

to show

day as a number 00, month as a number 00, year as a number 0000, hour as a number 00, minute as a number 00, second as a number 00, millisecond as a number 0000

I then need the module to perform a calculation using these numbers:

number 1 from first digit of day + second digit of day, number 2 from first digit of month + second digit of month, etc.

The purpose of this module is to add each number in the date and time to get a 1 or 2 digit number. If the result <= 2 digits, I can work with a 2 digit number. If the result >= 100, I need to further reduce it.

The concept is the numerology method of taking a series of numbers and reducing them down to a 1 digit number, but I can deal with 2 numbers for this experiment.

The experiment:

I am testing a methodology of random number generation by using the exact current date and time, down to the millisecond, to generate a current 1 or 2 digit number every millisecond. For testing purposes, we can work with seconds to see slower results return every 1 second.

The objective of the experiment is to get a random number that bypasses the traditional method of RNG, which creates a number not very randomly. The traditional method repeats the same numbers each time you run the module.

This method will create a new random number based on the current DTG every 1 millisecond, generating a new random number every time the module runs, and no pass can create the same random number unless the DTG comes to the exact same calculation (which is way more random than the built in RNG system in most software, despite the fact that the number is being created methodically and not randomly).

Intent with this project:

I want to utilize a system of RNG to create a 1 or 2 digit number that can be used on a sliding scale of 0-9 or 00-99, with the idea in mind of using this RNG engine to generate a random number every 1 millisecond for a game that utilizes RNG in other components.

For example:

The RNG Engine generates a number 0-9 or 00-99 every 1 millisecond. That number can now be used to determine hit or miss, chances for critical hits, chances for successful actions in a chance based mechanics, etc.

Building a complex system like those used by current game engines has proven very complex and problematic for me in the past, so i want to avoid those for now. This system, as far as I know, is not used or has not been used before. If it has, great, this should be easier. If not, the system can create random numbers at a fast pace and in a method that cannot be accurately cheated by people using timed attempts to hit a button at a specific time (as is done in many games). This method will be far too fast for any such physical attempts, and would require a computer to do it and the knowledge that the system is being used.

Like I said, this is an experiment. The fact that there may be better RNG tools out is irrelevant. I can deal with those later as needed. For now, I want to make this module as I have presented for testing purposes only. I need to run it in HTML first, and then I need to run it in Java Script. Down the road I can work on PHP once I have tested a number of iterations.

So, what I should see is something like this: (and here begins the pseudo pseudo code)

<code>
    //NOTE: "~" and "..." represents repetitive iteration over the array, i.e. - I skip stuff.

    //var set
    int number_1(day);
    ~
    ~
    int number_7(millisecond);

    //Gets the DTG and returns the values.
    get DTG();

    //Gets the values from DTG and makes them individual integer values.
    set Perform(){
        number_1 = DTG(dd);
        number_2 = DTG(mm);
        ~
        ~
        number_7 = DTG(ssss);
    }

    //Conducts a calculation on those values.
    calc1(){
        number_1 = number_1(digit1) + number_1(digit2);
        number_2 = number_2(digit1) + number_2(digit2);
        ~
        ~
        number_7 = number_7(digit1) + number_7(digit2) + number_7(digit3) + number_7(digit4);
    }

    //Calculates the returned values [number_1-number_7].
    calc2(){
        int someNum = number_1 + number_2 + ... + number_7;
        if(someNum >= 100; reduce to a num < 100){
            code
        }
        return someNum(where someNum must be a number between 0-9 or 00-99);
    }

    //I use the calcs to get the numbers I need.
    int iNeedTheseNumbers perform calc1(get [number_1, ... , number_7]);
    int theseNumbersToOneNum perform calc2(get someNum);

    if(theseNumbersToOneNumber >= 100; reduce to num < 100){
        code;
    }

    //Return the 1 or 2 digit number.
    return theseNumbersToOneNumber;
</code>

Yes, I know this pseudo pseudo code is not great, it's been years since I did any of this stuff. I apologize for this, especially if it causes confusion. I tried to make it in a way that is easy to understand what I am trying to get, using terms and methods I can remember from my school days.

I'm sure you'll have questions, so feel free to ask.

Again, I am trying to make an RNG engine using both HTML and Java Script separately, to generate a 1 or 2 digit number by performing addition on the values of the current DTG down to the millisecond, where the numbers used in the DTG are reduced down to make the 1 or 2 digit number.

For clarification on the numerology reference, see http://ift.tt/1Ts3Rjj and scroll down to the Latin Alphabet system entry.




Aucun commentaire:

Enregistrer un commentaire