Improved randomness (part 1) (#7882)

Faster and with no module bias

Removed rnd_init, rnd_uint32 and rnd_uniform
From now on we will only use rnd_value(min, max) for values in range [min, max] and rnd_chance(chance, base) for chances

Fixes #7881
Fixes #7883
Fixes #7884
Fixes #7885

Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
Lemon
2023-12-20 00:12:15 +01:00
committed by GitHub
parent ad3a2e99eb
commit 7c153416bc
20 changed files with 83 additions and 107 deletions

View File

@@ -23561,11 +23561,11 @@ void clif_parse_laphine_upgrade( int fd, map_session_data* sd ){
item->refine = rnd_value( upgrade->resultRefineMinimum, upgrade->resultRefineMaximum );
}else{
// Otherwise it can only be upgraded until the maximum, but not downgraded
item->refine = rnd_value( item->refine, upgrade->resultRefineMaximum );
item->refine = rnd_value<uint16>( item->refine, upgrade->resultRefineMaximum );
}
}else if( upgrade->resultRefineMinimum > 0 ){
// No maximum has been specified, so it can be anything between minimum and MAX_REFINE
item->refine = rnd_value( upgrade->resultRefineMinimum, MAX_REFINE );
item->refine = rnd_value<uint16>( upgrade->resultRefineMinimum, MAX_REFINE );
}
// Log retrieving the item again -> with the new options