I know of no standard module function that would produce such a nearly-random number.
I think you would have to put the function that created the random 4-digit string in a While loop and then test the result to see whether the characters were consecutive and if they were then re-generate the 4-digit string again. If a non-consecutive character was detected you could set the return value and break out of the While loop. You could test for consecutive numbers by examining the difference between the first & second character, the second & third, etc to see if the absolute difference was less than two