RealDocs

UKismetMathLibrary::RandomPointInBoundingBoxFromStream

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Returns a random point inside an axis-aligned box, drawn from a specific FRandomStream so the point can be reproduced given the same seed.

Caveats & Gotchas

  • HalfSize is a half-extent, not the full box size — passing the full box dimensions produces a box twice as large as intended.
  • Negative components in HalfSize are not rejected; they flip which side of Center the range is sampled from rather than raising an error.

Signature

static FVector RandomPointInBoundingBoxFromStream(const FRandomStream& Stream, const FVector Center, const FVector HalfSize)

Parameters

Name Type Description Default
Stream const FRandomStream& The random stream to draw from.
Center const FVector Origin of the axis-aligned bounding box.
HalfSize const FVector Half-extent of the box along each axis, measured from Center.

Return Type

FVector

Example

Deterministic spawn point within a zone C++
FRandomStream ZoneStream(ZoneSeed);
FVector SpawnPoint = UKismetMathLibrary::RandomPointInBoundingBoxFromStream(ZoneStream, ZoneCenter, FVector(500.f, 500.f, 0.f));

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.