Easiest way to get a random number is to start with some input (maybe a counter?) and hash it. And there you go, you have several bits of randomness right there. This is what I've had in my projects like dojo-shooter
to, say, pick the coordinates where a zombie spawns.
This works fine for trivial games but I can easily predict exactly where the zombies will spawn well before the game starts.
You can use randomness from other contracts as salt. But idea is pretty much the same.
shramee/cairo-random
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Verifiable random function and general randomness in Cairo
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published