Assumes you know how to add an animation blueprint to a character
Method 1. With a state machine
Add an animation blueprint to your character
Inside the Event Graph add a float called Random Start Time and give it a max value below the max length of your animation in seconds. Set Random Start Time node is followed by a short delay and then its set back to 0. This is so that the palindrome, when its playing backwards will play backwards all the way to the start of the animation.

Add a State Machine to the AnimGraph. Mine looks like this:

inside the Forwards State drag in your animation and hook it up. In the details panel you have to expose the pin for Start Position – then hook it to the Random Start Time. I’ve also got a Current Play Rate. Add this float too, and expose the pin, but for now just compile and set Current Play Rate to 1.

Inside the Backwards State hook it up like this, – the current play rate is reversed by multiplying by -1 to play the animation backwards.

The Forwards and Backwards states are connected by 2 transition rules that govern when one state should change to the other.

Inside the Forwards to Backwards transition, we use a Current Time (ratio) – if it’s equal or greater than 1 we transition to backwards.
Inside the Backwards to Forwards transition we have to do something slightly different and use a Time Remaining (Ratio) if its equal or less than 0 then we transition to forwards.

I have selected both transitions in the top level of the state machine and set the Blend Settings /Duration to 0.
This set up should start the animation at a random point and then play it forwards to the end, then play backwards to the start, then forwards etc.
Now if we want to get a bit fancy and vary the playback speed we can use do this – add some more nodes to the Event Graph. Here a New Play Rate is set in the Initialize Animation. Then in the update animation we use an FinterpTo to continually interpolate between the Current Play Rate and a New Play rate. The New Play Rate gets reset every 8 seconds. This works great if you have several of the same character playing the same anim in the scene. (incidentally, the Change Speed is set to 0.2)

Method 2. In the character blueprint
There’s another way to do this without state machines. Here we do all the coding inside the character. The character does not use an anime BP but has its Animation Mode set to Use Animation Asset set – in the level like this:

In the Construction Script we explicitly set the animation to play on the mesh like this (incidentally I have 2 meshes, but you probably won’t)

Then in the Event graph we Set Position (this is the animation start position, once again in seconds). And I’m setting the Play Rate randomly too.

To make it palindrome I’ve got this. Basically on Event tick I check to see if the animation position is greater than 80 (my anim is 86 seconds long ) and then flipping the play rate. If its less than 1 then the play rate is forward.

To continually vary the play rate its the same thing as with the StateMachine im using an Finterp and setting the Current Play Rate. This is also coming from Event Tick as is the delta seconds

There’s a bit to actually play the animation based on the Current Play Rate and the Play Direction Modifier variables. Play Direction Modifier needs to default to 1.

The whole graph looks like this

Further Notes

I had a mirror character (for a fake reflection – that’s the ‘character mesh’) Because I wanted the regular mash and reflected mesh to sync I thought that I could use a Random Float in range from Stream. This does work – the two meshes sync BUT every time the scene loads it starts from the same frame. This would be good if there were several copies of the same character. For this reason I’m not using the state machine method, instead the second method. I have an actor in the level generating a random variable on begin play between 1 and 100 and setting a fake global variable in the Game instance. Then I’m using getting that variable back here and ranging it to the values I need. (Also in red bit at the top it there is another way to get the variable – where I’m getting a reference to the actor in the level by exposing the BrunoActorReference and using the eyedropper to select the random actor) BUT I’m using my fake global method instead…

