Raised This Month: $ Target: $400
 0% 

Generate Random Unique Numbers for Any Range


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 12-29-2016 , 10:39   Re: Generate Random Unique Numbers for Any Range
Reply With Quote #1

Quote:
Originally Posted by Shattered Heart Lynx View Post
Generating random unique numbers for any range.
This is "deferred" random unique numbers. Where can I use them?
__________________

Last edited by PRoSToTeM@; 12-29-2016 at 10:39.
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 12-29-2016 , 13:26   Re: Generate Random Unique Numbers for Any Range
Reply With Quote #2

Quote:
Originally Posted by PRoSToTeM@ View Post
Where can I use them?
Let us suppose:
  1. You are developing a map chooser plugin.
  2. You need to sort 5 maps from a map list.
  3. You do not want to sort the map map twice for performance questions.

For each map you sort you must to check whether they meet several criteria as:
  1. The map prefix as `de_` must to be unique on the menu.
  2. The map not to be present on the recent maps list.
  3. The map must to to be present to the current hourly blocked list.

So, sorting the same number, on the map index range is processing lost, so would be nice not to sort repeated numbers.

Also the other approach would be to remove all the maps from the map list so we can just sort any.
However this has the following characteristics:
You would have to duplicate the map list as it can be used for other map voting.
You would have to remove the duplicated prefixes from the maps list while duplicating.
You would have to remove the maps from the recent list and hourly list, while duplicating it.

So, I just to choose the first implementation, instead of the second one.
May be the second is trivially better than the first, or otherwise.
Anyways, I already got the second implementation fully working.
So, I would not spend my time doing the second one, if the first one
is not lacking or creating performance problems which cannot be dealt with.
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 12-29-2016 at 14:03.
addons_zz is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:47.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode