Question: I currently have the hidden attribute of one of my divs binded to a boolean in my typescript. But, when I am changing the value of the boolean in one of my function calls nested within an object the dom is not updating on the front end? 

**typescript**

```js
hideSymbols = true;

bindings = {
    enter: {
      key: 13,
      handler: function() {
        console.log('enter pressed');
        this.hideSymbols = !this.hideSymbols;
        console.log(this.hideSymbols);
      }
    }
  };
```

**html**

```js
<div [hidden]="hideSymbols">
   <button id="equalsBtn" class="symbolBtn">=</button>
   <button id="impliesBtn" class="symbolBtn">=></button>
</div>
```

It works if I am not making the call in this handler but I need to in order for my ngx-quill instance to update how the enter key works. Essentially, **why is hideSymbols getting updated but on my web view the element does not disappear and reappear?**

Answer: 
The easiest way is to use `shuffle` function in **lodash** package. <https://lodash.com/docs#shuffle>  

Then select the the number of colors you want from the randomized array:

```
const colors = ['blue','red','orange','purple','gray','yellow'];
const selectedColors = _.shuffle(colors).splice(0, 3);  // 3 random colors
console.log(selectedColors);

```
Maybe a clumsy implement

```
function random_num_between(min,max){
  return Math.floor(Math.random()*(max-min+1)+min);
}

function pick_one(list){
  const index = random_num_between(0,list.length-1)
  return list[index]
}

function get_elements_distinct(originList,num){
  const map = {}
  let counter = 0
  while(counter < num){
    const key = pick_one(originList)
    if(map[key] == null){
      counter ++
      map[key] = 1
    }
  }
  return Object.keys(map)
}

```

Then you can use it

```
let colors = ['blue','red','orange','purple','gray','yellow']
let randomColors = get_elements_distinct(colors,3);

```