Randomize uv's


I am trying to randomize a wood texture on multiple (hundreds) of cabinets so every wooden panel has a unique texture.
The image I have is in reality 280 x 280 centimeters and I want all the uv’s of my cabinet objects randomly distributed over this area. This however is proven to be pretty difficult even though it sounds pretty simple.

The steps I currently take are: creating a uvw map set to box with 280x280x280. So far so good. Problem is all uv’s are centered in the middle and every surface has pretty much the same part of the texture. Second problem is that the sides of each panel are vertical aligned and as a result the texture direction isn’t correct (it needs to follow the direction of the wood). To solve this I add a UVW unwrap modifier and manually rotate the vertical aligned surfaces to a horizontal position. Then I select all uv’s and use the pack together function (rescale unticked). The problem however is that a lot of the uv’s go outside the uv tile. This doesn’t have to be a big problem however some of the uv’s are right on top of the borders creating seams in my (not seamless) texture. If there where only a few cabinets, I could have corrected this by hand. But I have hundreds of cabinets making this a complete nightmare.

So I searched for a script only to solve my problems but so far none have met my expectations. I have found this little script that almost does what I want: uvw-randomizer on scriptspot
It randomizes the uv’s based on a uvw map and if you untick Tiled map it randomizes the uv’s inside the uv tile. All uv’s will be overlapping but that doesn’t matter. Problem however is that I, as mentioned before, need to rotate the vertical aligned sides. Doing this after the randomizing is pretty much impossible but I can’t do it before the randomizing because the script needs a uvw map modifier as base.
I’ve tried various other scripts but they all have 1 or more limitations. Either they only work for seamless maps or they rescale everything.

Does anybody know of a functionality inside Max that can do what I want or knows a script that does exactly what I want?

I’ve tried to write my own script but so far unsuccessful.
I’ve tried with the creation of a uvw_xform modifier. With that I can first add the uvw box map followed by the unwrap uvw to rotate the vertical aligned sides. Than I can add the uvw_xform to randomize the uv’s.

	for b in selection do
					if iskindof b.modifiers[1] UVW_Xform then
						dimensions = b.max - b.min
						b.modifiers[1].u_offset += (random -((1 - dimensions[1])/2) ((1 - dimensions[1])/2))
						b.modifiers[1].v_offset += (random -((1 - dimensions[2])/2) ((1 - dimensions[2])/2))
						b.modifiers[1].w_offset += (random -((1 - dimensions[3])/2) ((1 - dimensions[3])/2))

This however doesn’t take the uv tile borders into account and placing the uv’s randomly but also on top of the tile borders.

Any help is greatly appreciated.