• Java compatible RNG algorithm

    Home » Forums » Developers, developers, developers » DevOps Lounge » Java compatible RNG algorithm

    Author
    Topic
    #475668

    I’m looking for an algorithm for a Random Number Generator for a Java project. I don’t necessarily need code (though it would make my job easier) it just needs to be compatible.

    Java does of course have it’s own RNG (math.random()) but I was hoping to make my own. I haven’t decided on a seed yet so it doesn’t really matter if the algorithm comes with a specific one in mind so long as the seed value doesn’t have a limit (the standard seed in Java’s RNG is the number of milliseconds since 1970). The output needs to be in the range of 0 to 1 not including 0 or 1 (this way I can just plug and play between the standard Java RNG and another).

    For clarity: Java doesn’t really support uint (unsigned intergers or the like). So, this has to work without relying on unsigned values (like all the others I’ve found).

    For the seed I’m planning to combine some value from the system (like the time thing) with a number supplied by the end user. A debug module could of course remove the system induced number for predictable results.

    Reply To: Java compatible RNG algorithm

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: