What you're likely looking for is array shuffling. This thread contains some useful functions for it: https://stackoverflow.com/a/2450976/13199472 (personally, I like using the ES6 variant of Durstenfeld shuffle algorithm, which is the second answer in that thread).
With the shuffle function available, your code should look something like this:
arr = [1,2,3,4,5,6,7]
shuffle(arr)
result = `${arr[0]} and ${arr[1]} and ${arr[2]}`
There is no need for a separate variable. However, since you mentioned your dataset contains strings where template tags have the same name, a possible solution would be to not treat the string as a JavaScript template literal, but rather, a plain string in which you will replace tags individually.
let arr = [1,2,3,4,5,6,7]
shuffle(arr)
// notice how these are STRINGS, not template literals, they
// are inside single quotes, not backticks
// using backticks here will break your code
const template = '${val} and ${val} and ${val}'
const tagCount = template.split('${val}').length
let output = template;
for (let i = 0; i < tagCount; i++) {
output = output.replace('${val}', arr[i])
// you can take arr[i % arr.length] instead of arr[i]
// in case you have more tags than items in the array, but
// this will obviously result in duplications
}
String.prototype.replace
will only ever replace the first occurrence of the provided string, so this approach will allow you to replace each tag one by one with an item from the shuffled array.