Skip to content

Latest commit

 

History

History
113 lines (99 loc) · 3.77 KB

README.md

File metadata and controls

113 lines (99 loc) · 3.77 KB

DreamBot RNG Visualizer

This is a mostly useless utility script for DreamBot to visualize the distribution of various random number generators. Inspired by this forum thread. (Gaussian algorithms taken from that thread, with some cleaning and a couple bug fixes)

X-Axis of the graph is each potentially generated point. Y-Axis is the relative probability of being generated. Points higher on the y-axis have a higher probability of being generated than other points.

Green points are points that tie for the highest probability. Orange points are generated points that tie for the lowest probability. Red points are points that haven't been generated at all.

Yellow line is an average of the surrounding generated points. Blue line is a bezier curve using the averages of the generated points as control points.


Contains visualizations for the following algorithms:

Standard (random.nextInt())

Standard 300 Standard 20

Low (random.nextGaussian() with a low bias)

Low 300

Mid (random.nextGaussian() with a mid bias)

Mid 300

High (random.nextGaussian() with a high bias)

High 300

Park and Miller

Note that this algorithm is very slow, especially when you clamp it to very small values. PAM 300

Mersenne Twister

MT 300

W (Mixture of Low, Mid, and High)
private int generateW()
{
    switch (Random.nextInt(3))
    {
        case 0:
            return Random.low(points.length / 2);
        case 1:
            return Random.mid(points.length / 3, points.length / 3 * 2);
        default:
            return Random.high(points.length / 2, points.length);
    }
}

W 300

Humps (Two Mids side by side)
private int generateHumps()
{
    if (Random.nextInt(2) == 0)
        return Random.mid(points.length / 2);
    return Random.mid(points.length / 2, points.length);
}

Humps 300

Valley (Mixture of Low, Mid-left, Mid-right, and High)
private int generateValley()
{
    switch (Random.nextInt(4))
    {
        case 0:
            return Random.low(points.length / 3);
        case 1:
            return Random.mid(points.length / 5 * 2);
        case 2:
            return Random.mid(points.length / 5 * 3, points.length);
        default:
            return Random.high(points.length / 3 * 2, points.length);
    }
}  

Valley 300