# Randomize Array of FTransform and compare if the elements are duplicated C++?

**URL:** <https://forums.unrealengine.com/t/randomize-array-of-ftransform-and-compare-if-the-elements-are-duplicated-c/628877>\
**Category:** C++\
**Tags:** UE4-20, unreal-engine, UE4, question, CPP\
**Created:** [August 15, 2022, 3:19pm UTC](https://forums.unrealengine.com/t/randomize-array-of-ftransform-and-compare-if-the-elements-are-duplicated-c/628877 "2022-08-15T15:19:51Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![zeaf](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zeaf/32/1108035_2.png) [@zeaf](https://forums.unrealengine.com/u/zeaf)\
**Post date:** [August 16, 2022, 12:01pm UTC](https://forums.unrealengine.com/t/randomize-array-of-ftransform-and-compare-if-the-elements-are-duplicated-c/628877/13 "2022-08-16T12:01:00Z")

</div>

The issue is, like others have mentioned that transform in UE doesn’t have a binary operator, so the array internal functions Find or Contain cannot compare each element to the one you want to search for.

If you really want to do it that way, then you can use something like this:

```auto
if (UsedLocations.ContainsByPredicate([RandomLocationOut] (const FTransform Transform)
	{
		return Transform.GetLocation() == RandomLocationOut.GetLocation()
			&& Transform.GetRotation() == RandomLocationOut.GetRotation()
			&& Transform.GetScale3D() == RandomLocationOut.GetScale3D();
	}))
{
     // Your then code here
}
else
{
    // Your else code here
}

```

---

_[View the full topic](https://forums.unrealengine.com/t/randomize-array-of-ftransform-and-compare-if-the-elements-are-duplicated-c/628877)._
