Random database selection without the gallery slider changing too

I am trying to create a filter that will randomly show me just 10 items after clicking a button:

export function surprise_click(event, $w) {
$w(“#dataset2”).setFilter( wixData.filter() );

// get size of collection that is connected to the dataset
let count = $w(“#dataset2”).getTotalCount();

// get random number using the size as the maximum
let idx = Math.floor(Math.random() * count);

// set the current item index of the dataset
$w(“#dataset2”).setCurrentItemIndex(idx);
}

However, this causes my gallery slider (which is also connected to the dataset) to change as well. Additionally, my repeater section only changes for a second, before it changes back when the gallery slider turns to the next slide. Help?