I'm trying to solve this problem with several functions but didn't managed to get the final result.

PROBLEM:
I want to generate a 1000 random numbers (range is from 1 to 6), but without repeating last and second last number. For example:

This is good: 3, 5, 1, 2, 3, 5, 6, 2, 1, 6, 4, 3, 5, 1, 6, ...

This is not good: 3, 5, 1, 2, 2, ... (because number 2 is showing two times in a row)

This is not good: 3, 5, 1, 2, 1, ... (because number 1 is showing again after number 2)

I'm trying to generate the list of random numbers but following this rules above, so it's not fully random list of numbers ...
Do I need to use array formulas?