---
title: "cycleSeed"
description: "A random but stable number, 0..1, for each cycle index."
group: "space"
groupTitle: "Shapes, frames & warps"
categoryId: "motion"
categorySlug: "motion"
categoryTitle: "Motion & timing"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/motion.ts#L72"
---

# cycleSeed

A random but stable number, 0..1, for each cycle index.

```ts
cycleSeed(index: Expr, salt: number = 0): Expr
```

Import `motion` from `shaders/std` and use `motion.cycleSeed`.

The same index always gives the same value, so a meteor keeps its angle for the whole pass and picks a new one next time. Change `salt` for a second, independent draw.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `index` | `Expr` |  |
| `salt` | `number` | Optional. Default `0`. |

## Example

```ts
const hue = motion.cycleSeed(index)
const size = motion.cycleSeed(index, 1)
```

## See also

- [`cycle`](/docs/primitives/motion/cycle) — A repeating cycle as two numbers: `progress` (0..1 through the current cycle) and `index` (which cycle this is).