Skip to main content
Random number generation in Multisynq is designed to maintain perfect synchronization while giving you flexibility where you need it. Understanding how randomness works in models versus views is crucial for building applications that stay synchronized across all users.

Core Concept

Models: Math.random() produces identical sequences across all devices for perfect synchronization.Views: Math.random() produces different sequences on each device for local variety.
Models use deterministic random sequences
Every call to Math.random() in the model produces the exact same value on all devices, ensuring perfect synchronization.

Practical Examples

Examples where models MUST use synchronized random
Examples where views SHOULD use local random

Best Practices

🎯 Model Randomness

Use for synchronized game logic

🎨 View Randomness

Use for visual variety only

Common Mistakes

Avoid these random number generation errors:

Advanced Patterns

Next Steps

Writing a Multisynq Model

Learn more about model constraints and synchronization

Writing a Multisynq View

Understand view-specific patterns and local randomness

Sim Time & Future

Master timing and scheduling with synchronized randomness

Simple Animation

See randomness in action with animated examples
Random number generation in Multisynq is a powerful feature that ensures perfect synchronization when used correctly. Remember: models get identical random sequences for game logic synchronization, while views get independent random sequences for visual variety. Use this distinction to build engaging, synchronized multiplayer experiences.