Currently the Adpative Scrambling Distance is calculated based off of the sample count of the final render, but that value can be used in viewport rendering if the option is enabled. As such, basing the Adpative Scrambling Distance off of the sample count of the final render (which by default is higher than viewport rendering) can lead to more corrolation artifacts that would be expected in the viewport.
This patch addresses this issue by calculating the Adpative Scrambling Distance based off of the sample count of the current render mode (viewport or final render).