forum

osu Random number generator clearly not random [Resolved]

posted
Total Posts
22
Topic Starter
ntan1
I'm wondering why osu's random number generator for selection of maps upon pressing of F2 shifts between the same maps over and over. It's clearly not random, and this should honestly be easy to fix from a development standpoint.

Thus, I have a feeling it's a developer decision, and I'm wondering why.
anonymous_old
Is it choosing the same MAP (difficulty + song), or the same SONG? Also, what map/song is it choosing?
Topic Starter
ntan1
It's the same map, and in this case for me, Boukoku Kakusei Catharsis, either 4 star or 5 star. and Afterlife-Glide 5-star with 421 circles.

Since I wasn't clear on my first post, i'll give more helpful information:

Using: Windows 7 64-bit
Exact criteria: Using F2 for map selection, the same small set of 4-5 songs with potential slight changes in difficulty is selected repeatedly 8-10 times. I've been able to reproduce this with 100% accuracy, and while it appears on Show All selected, it is much more clear for me when sorting by date. I have a total of 3169 bitmaps, although this has occurred with 1500 bitmaps, and fewer.
Aeon
I had the same issue when i had few maps, but now i got over 1200 and its not too often that the same music is chosen
I tried to reproduce your issue with the same conditions, and every time i got a diferent song, to try to get over your issue press F2 before the random selection is over and the generator will stop
Ph0X
There is no such thing as "random" in this universe.
Even with QM.
Guy-kun
This map has been deleted on the request of its creator. It is no longer available.
Lybydose
This just sounds like the birthday paradox. Even if you have thousands of maps, the average number of times you need to hit random before you get a repeat will be very low. For example, out of about 1430 SONGS (not maps), I only had to hit random 26 times before I got a repeat.

Furthermore, if you specifically look for a particular thing, your mind will start seeing that thing everywhere. If I start thinking "oh man random ALWAYS gives me Don't Say Lazy" then it will seem like that because I'll remember it every time it actually does give me Don't Say Lazy. I'll forget the other 99% of songs it gives me.
Guy-kun
Well kinda to do with thinking, but I end up playing what I get in random, then later scrolling through the list, I find good maps I barely ever get to play when on random, IDK

I think this could be solved once and for all if Peppy just came and confirmed it was a good randomization algorithm/ whatever function he used was good
Gabi
IIRC other peopel complained about this aswell but it got denied. can't remember why though
peppy

ntan1 wrote:

I'm wondering why osu's random number generator for selection of maps upon pressing of F2 shifts between the same maps over and over. It's clearly not random, and this should honestly be easy to fix from a development standpoint.
How rude. Since this comes up so often, let's dedicate 10 minutes to answering your presumptuous statement.

Test 1:
http://pe.ppy.sh/random-generation.txt
1,000,000 queries over random 0,2999.

Test 2:
http://pe.ppy.sh/random-generation-2.txt
1,000,000 queries over random 0,2999.
Random generator re-seeded every 1,000 queries (in same manner osu! is seeded).

osu! psuedo-code for roulette:
function start()
{
currentIndex = rand(0,beatmapCount);
rouletteRunning = true;
rouletteSpeed = 50;
}

function end()
{
rouletteRunning = false;
doSelection();
}

function update()
{
if (rouletteRunning)
{
currentIndex = (currentIndex + rouletteSpeed) % beatmapCount;
rouletteSpeed /= 1.4;
if (rouletteSpeed < random(10,30))
end();
}
}

No changes since first implementation almost two years ago.

I should mention that the only flaw I see in this algorithm is that maps with more difficulties will get more chance of being selected. This shouldn't be a huge issue, though.
Derekku
@Gabi: Yeah, the reason people were complaining is that maps with more diffs will have a higher chance of being selected than those with less (like peppy said).

So... could it be changed to just be based on songs rather than difficulties?
awp
This map has been deleted on the request of its creator. It is no longer available.
Topic Starter
ntan1
Then it's clearly a separate bug that has little to do with the random number generator, but could occur due to a one of many other reasons.

This isn't the Birthday paradox, because assuming that values are generated randomly, the probability that you hit the same value in the row 2-4 times decreases by the binomial distribution, and I've had the same song pop up 5 times in a row at least a few times. I also notice that this tends to mainly be a problem when songs are sorted by date. I wouldn't blame threading directly as an issue here, but there could be multiple reasons why this occurs; two potential causes are listed below:

(1) Race condition that resets one value somewhere,
(2) Calculation of one of the initial variables is incorrect, which generally will be easy to test or compare

I apologize if I'm blunt or potentially rude here, but I say things this way because most programmers that I know would rather have all of the information and criticism put in front of them directly over anything. If I had direct access to the source code and a project was open sourced, I'd probably look into the problems myself and set up at least a view hooks/logs to check out the issue myself. However, it does appear that the issue is a bug and not intended effect.
peppy
It's not "clearly" anything, unless you can provide an accurate method of reproducing this.

1. Impossible as no threading is involved in this specific scenario.
2. I've already double-checked and cannot see any problems.

Are you able to provide a video of this happening or something similar? Even a list of songs chosen in consecutive order when using random to actually show how reproducible this is.
Topic Starter
ntan1
Yes:

http://www.youtube.com/watch?v=dHfPHIJlsTs

As you will note, the issue is sporadic but is definitely occurring.
Lilac
Moskau, anyone?
peppy
Does it happen on "Show All"? Could quite likely be happening only with non-standard grouping methods.
Topic Starter
ntan1
It does not happen with Show All.
qlum
You could just pres ctrl+r again to stop the roulette and when you don't do this at the same time you can make it more random for yourself.
Topic Starter
ntan1

qlum wrote:

You could just pres ctrl+r again to stop the roulette and when you don't do this at the same time you can make it more random for yourself.
This has the exact same effect using F2, and the bug can still be replicated.
peppy
All fixed, btw.
Topic Starter
ntan1
Yep! Thanks - it works as intended.
Please sign in to reply.

New reply