A function in my application requires access of an array element.
I can either generate a random index every time this function is called or store the previous visited index into localStorage and then get this value and initialize index to 1+previous\_index

I need to persist the index data for the case when user visits my application again.

So, now I have to choose between one. Either use **Math.random()** or use **localStorage**.

Which option will be more faster.

**PS :** even though this will have a very less impact on performance. But The main question here is **Are localStorage access heavy operations**