How to make sure each widget id is unique

How can I make sure that each widget id is unique I know there’s a php function uniqid

But not 100% how to use it to ensure each widget generated has a different id value.

As simple as using the below:


'id' => uniqid(),

This is the way currently.