You are correct about GetAngles and SetAngles. These two functions are for retrieving and setting the angles of an object, respectively.
GetAngles returns a vector (just like GetOrigin) that contains the pitch, yaw and roll components.
SetAngles is a little bit different: it expects three parameters, one for each of the pitch, yaw and roll components.
For example, you can transfer the orientation of one entity to another like so:
local angles = first_entity.GetAngles()
second_entity.SetAngles(angles.x, angles.y, angles.z)
I have updated my script to also look at the orientation of each entity, and maintain those orientations for each position, after swapping the entities. If you don't feel like messing around with GetAngles and SetAngles yourself, then feel free to use this script. But note that "messing around" is also commonly referred to as "learning" 
shuffle_ents V2 Change notes
||I changed the name of the "main" function to "shuffle", to better indicate what it does.
The script now also records the orientation (angles) of each entity and applies them to the other entity that is moved to that position. The find_positions and shuffle_ents functions are modified to enable support for this. Instead of passing just location vectors, they now use composite objects that contain both a location and orientation (angles).
For some entity types, setting the proper starting angles in the map can be slightly tricky. For example, in the test map, I could not set the angles on the func_brush objects directly. (I tried adding an "angles" property outside of smart edit, but it just gets ignored.) So instead, each brush is attached to an info_target entity and the script is told to move these info_target entities. Rotating an info_target in Hammer does not set the angle unfortunately, so you have to edit the "angles" property directly. (There are controls for it in the top right corner of the properties window.)||