|This article is in need of content, please consider adding to it.|
This page elaborates the algorithm used to populate the Items shops. It can get a bit mathsy, though understanding the algorithm can help also to understand the odds of finding certain items; also, should it be needed, it can help with improving the odds of finding certain items. For new players, this page is probably a bit too much.
The shop algorithm in a nutshell is:
1. Start with a list of all potential items.
2. If quest or elite preparations are chosen, then move those items to the front of the list.
3. Remove prepared inventory items from the list.
4. Let the length of the list now be n.
5. Generate a random number in the range 0 to n^2.
6. Take the square root of that number, round down, and subtract from n-1.This is the index of the chosen item.
7. Remove the chosen item from the list.
8. Repeat steps 4-7 for each additional shop.
For normal dungeon runs, the potential item list is created by adding basic items, then unlocked quest items, then elite items.
For the DERPs, the potential item list is a fixed list containing all items, but the basic items are still at the start, and elite items at the end. For a given DERP seed and a given length n, the generated random numbers will be identical, but the chosen items depend on the order of the list as affected by preparations. If both quest and elite preparations are chosen, then whichever was last in the available preparations will be at the front of the list.