---
title: "SSRandomPointForSizeWithinRect(_:_:)"
framework: Screen Saver
role: symbol
role_heading: Function
platforms: [macOS 10.0+]
path: "screensaver/ssrandompointforsizewithinrect(_:_:)"
---

# SSRandomPointForSizeWithinRect(_:_:)

Returns a random point.

## Declaration

```swift
func SSRandomPointForSizeWithinRect(_ size: NSSize, _ rect: NSRect) -> NSPoint
```

## Parameters

- `size`: The horizontal and vertical amounts to subtract from the rectangle’s size.
- `rect`: The rectangle to contain the point.

## Return Value

Return Value A random point within rect, constrained within (rect.size - size) from rect’s origin.

## Discussion

Discussion The Screen Saver framework automatically seeds the random() C function to generate the point.

## See Also

### Utilities

- [SSRandomIntBetween(_:_:)](screensaver/ssrandomintbetween(_:_:).md)
- [SSRandomFloatBetween(_:_:)](screensaver/ssrandomfloatbetween(_:_:).md)
- [SSCenteredRectInRect(_:_:)](screensaver/sscenteredrectinrect(_:_:).md)
