12. Shuffling in SAS-RCS/RBS
by: saaiqSAS
Last Updated: 27/2/2025
Shuffling is performed in both SAS-RCS and SAS-RBS in a random yet deterministic manner,
using all the Static Keys as a source of random numbers. Static Keys are
applied in a "1234"/"Round Robin" method to select a random number. For instance, if 3
Static Keys are available, the 0 index of each Static Key together
will provide 3 random numbers. Once all the numbers at the 0 index are used, the
1 index is then accessed, and this process continues. After all indexes of the
Static Keys have been used, the method will restart from the 0 index. This
ensures that all Static Keys are required to reverse the shuffling process.
Example 12.1 below demonstrates this process.
Example 12.1: Random Numbers from Static Keys
Static Key 1 (st1): { 4, 8, 2, 7, 1, 6, 0, 5, 3 }
Static Key 2 (st2): { 6, 1, 7, 0, 3, 5, 8, 2, 4 }
Static Key 3 (st3): { 3, 8, 0, 6, 7, 5, 4, 2, 1 }
Order: st1[0], st2[0], st3[0], st1[1], st2[1], st3[1], st1[2], ...
Output: 4, 6, 3, 8, 1, 8, 2, 7, 0, 7, 0, 6, 1, 3, 7, ...
To shuffle the data, a swap operation is performed for each data unit. In SAS-RCS, the data
unit refers to individual characters, while in SAS-RBS, it refers to bytes. Each data unit is
swapped with the data unit at the position specified by the random number. If the random number
exceeds the data size, a modulus function is applied to fit the random number within the acceptable range.