---
title: "Get a random number from an interval"
description: "Generate a random number within a specified range in TypeScript."
date: "2025-10-02"
tags: ["typescript","math","random","frontend"]
canonical: "/snippets/typescript/number/random"
---

import { Code } from '@astrojs/starlight/components'
import Source from './random.ts?raw'

## Get a random number from an interval

<Code code={Source} lang="ts" title="random.ts" wrap />
