I want to create a grid with (partially) random values. Lets say the grid looks like this:

The other values should evolve from the values around them, whereas one value is fixed, like this:

The change in value from one field to another should not be bigger than one, but should be randomly. E.g., in the bottom right field there is a 7. The field above has a 6, so it could be 5, 6 or 7. The field to the left has a 7, so the value could be 6, 7 or 8. Since 6 and 7 appear in both list, the value has to be either 6 or 7.

Has anybody a good idea, how i could program this logic?