Skill / SKILL.md

Onchain Randomness

mystenlabs/skills

Explains how to generate and secure onchain randomness in Sui Move with the Random shared object at 0x8 and RandomGenerator. Use when the user asks how to generate a random number, roll dice, shuffle, draw a lottery winner, or assign a random NFT rarity in Move; mentions sui::random, Random (0x8), new_generator, generate_u128, generate_u8_in_range, generate_bytes, or shuffle; asks why a public function taking Random or RandomGenerator fails to compile; or asks about composition and abort-filtering attacks, PTB restrictions after a MoveCall consuming Random, RandomGenerator state leakage via bcs::to_bytes, commit-reveal patterns, balancing gas between winning and losing paths, or passing the Random object from TypeScript.
1 views 25 repository starsUpdated Nov 27, 2026
Overview

Explains how to generate and secure onchain randomness in Sui Move with the Random shared object at 0x8 and RandomGenerator. Use when the user asks how to generate a random number, roll dice, shuffle, draw a lottery winner, or assign a random NFT rarity in Move; mentions sui::random, Random (0x8), new_generator, generate_u128, generate_u8_in_range, generate_bytes, or shuffle; asks why a public function taking Random or RandomGenerator fails to compile; or asks about composition and abort-filtering attacks, PTB restrictions after a MoveCall consuming Random, RandomGenerator state leakage via bcs::to_bytes, commit-reveal patterns, balancing gas between winning and losing paths, or passing the Random object from TypeScript.

Installation & variants

Download the repository, including the skill’s supporting files.

git clone -- 'https://github.com/mystenlabs/skills' skill-source

Use the complete skill-source/onchain-randomness directory with your client’s skill installer.

Source directory onchain-randomness

Source instructions
Read source instructions

Open to load source instructions

Original SKILL.md

Open to load the original file

Source & validation
Source status
Awaiting source check
Format validation
Format valid
Checked at
Pending source check
Content SHA-256
5ddea3ced5b5335de46a34331df9c5bf6b96d9320a5cfc1548b736efdc6dd8b8
Discussion
Comments Be the First to Comment

Please log in to comment

    No comments yet

Related skills