---
title: "range(_:)"
framework: foundationmodels
role: symbol
role_heading: Type Method
path: "foundationmodels/generationguide/range(_:)"
---

# range(_:)

Enforces values fall within a range.

## Declaration

```swift
static func range(_ range: ClosedRange<Decimal>) -> GenerationGuide<Decimal>
```

## Discussion

Discussion Bounds are inclusive. A range generation guide may be used when you want to ensure the model produces a value that falls in some range, such as the cost for an item in a game. @Generable struct ShopItem {     @Guide(description: "A creative name for an item sold in a fantasy RPG")     var name: String

@Guide(description: "A cost for the item", .range(0.25...1000))     var cost: Decimal }
