US 12,443,457 B2
Efficient random sampling from dynamically changing sample pool
Can Goksen, Seattle, WA (US)
Assigned to Microsoft Technology Licensing, LLC, Redmond, WA (US)
Filed by Microsoft Technology Licensing, LLC, Redmond, WA (US)
Filed on Apr. 5, 2022, as Appl. No. 17/713,628.
Claims priority of provisional application 63/294,542, filed on Dec. 29, 2021.
Prior Publication US 2023/0205593 A1, Jun. 29, 2023
Int. Cl. G06F 9/50 (2006.01)
CPC G06F 9/5044 (2013.01) [G06F 9/5033 (2013.01); G06F 9/5088 (2013.01); G06F 2209/5011 (2013.01); G06F 2209/508 (2013.01)] 18 Claims
OG exemplary drawing
 
1. A processor-implemented method for cost-efficiently performing repeated random sampling operations from a first sampling pool, the method comprising:
defining a first array of elements to be selectively masked and unmasked throughout the repeated random sampling operations from the first sampling pool, the first sampling pool including unmasked elements of the first array and excluding masked elements of the first array;
defining a dummy array for tracking locations of elements that are moved between different positions within the first array, the dummy array storing identifiers for the elements in the first array in association with pointers to current locations of the elements within the first array of elements;
identifying an element within the first sampling pool that is to be excluded from a sampling operation;
removing the element from the first sampling pool by:
moving the element to a new position by swapping a first array index of the element with a second array index that was, during an immediately prior sampling operation, included within and bounding the first sampling pool; and
masking the second array index corresponding to the new position of the element;
updating a pointer associated with the element the dummy array to point to the second array index instead of the first array index; and
implementing the sampling operation by randomly sampling from the first sampling pool;
subsequent to the sampling operation, selectively adding the element back into the first sampling pool by:
swapping the second array index of the element with a third array index that was, during an immediately prior sampling operation, external to and bounding the first sampling pool;
updating the pointer associated with the element in the dummy array to point to the third array index instead of the second array index; and
unmasking the third array index.