---
title: "clamp(lowerBound:upperBound:)"
framework: gameplaykit
role: symbol
role_heading: Instance Method
path: "gameplaykit/gknoise/clamp(lowerbound:upperbound:)"
---

# clamp(lowerBound:upperBound:)

Replaces values in the noise field outside the specified range with the values at the endpoints of that range.

## Declaration

```swift
func clamp(lowerBound: Double, upperBound: Double)
```

## Parameters

- `lowerBound`: The minimum value to keep in processed noise.
- `upperBound`: The maximum value to keep in processed noise.

## Discussion

Discussion For example, if you specify lower and upper bounds of -0.5 and 0.5, this operation replaces values less than -0.5 with -0.5 and values greater than 0.5 with 0.5.

## See Also

### Applying Operations to Noise Values

- [applyAbsoluteValue()](gameplaykit/gknoise/applyabsolutevalue().md)
- [invert()](gameplaykit/gknoise/invert().md)
- [raiseToPower(_:)](gameplaykit/gknoise/raisetopower(_:)-14715.md)
- [remapValues(toCurveWithControlPoints:)](gameplaykit/gknoise/remapvalues(tocurvewithcontrolpoints:).md)
- [remapValues(toTerracesWithPeaks:terracesInverted:)](gameplaykit/gknoise/remapvalues(toterraceswithpeaks:terracesinverted:).md)
