You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary or problem description
I think Neo should provide interops for lightweight pseudo-random number generators, such as Mersenne Twister. These are cheap on gas costs, and quite useful, as fueling them with entropy-based hash seeds (from blocks, transactions, or mixed) are secure strategies for smart contract random solutions.
A follow up from nice discussion in #1657.
Do you have any solution you want to propose?
Introduce interops for Mersenne Twister and other lightweight pseudorandom generators.
Some Interop may, for instance, initialize the desired generator (Neo.Random.InitializeMT), and others may take pseudorandom values from given interval (Neo.Random.NextIntRange).
Note that, it's very important to provide Range-Based integer generation, such as NextIntRange operation), as mostly adopted practices using mod operator (GetRandom() % INTERVAL) are very biased (it is well known, but I can also look for academic works on that matter). One good example is the C++11 random generator library, that has the concept of "distributions", like uniform_distribution, to operate over generators in a less-biased manner.
[EDIT]:
In time, we should also DEFINITELY provide Neo.Random.Shuffle for arrays (and maybe... Neo.Random.Sort, why not? To keep things "symmetric" 👍 ).
Neo Version
Neo 2
Neo 3
Where in the software does this update applies to?
Interop
The text was updated successfully, but these errors were encountered:
Support! I have spoken to a few developers in the past who have asked about on-chain rng, specifically for games. I have pointed them to this in the past, but having interops for it sounds much better.
I hope we can provide something like this for those that don't want to go through oracles.
This post is actually amazing @EdgeDLT , I've crossed by it some months ago.. and in fact, generating pseudo-random numbers in a practical and less-biased manner has also been a challenge for "famous languages", such as C++. Only in C++11 standard, the uniform distribution pattern was introduced, and still today, I guess 99% of the developers just use the pattern "rand() % MAX" to extract range-based numbers.
Also, maybe few people are also confident with Mersenne Twister and others of the sort, but they are pretty good! As long as you seed them with a nice entropy, which is the "hard part", the rest should be easy for users. By providing them with such easy-to-use feature in a secure manner (which is), is the best possible world. Thanks for the support, let's see how it goes!
Summary or problem description
I think Neo should provide interops for lightweight pseudo-random number generators, such as Mersenne Twister. These are cheap on gas costs, and quite useful, as fueling them with entropy-based hash seeds (from blocks, transactions, or mixed) are secure strategies for smart contract random solutions.
A follow up from nice discussion in #1657.
Do you have any solution you want to propose?
Introduce interops for Mersenne Twister and other lightweight pseudorandom generators.
Some Interop may, for instance, initialize the desired generator (
Neo.Random.InitializeMT
), and others may take pseudorandom values from given interval (Neo.Random.NextIntRange
).Note that, it's very important to provide Range-Based integer generation, such as
NextIntRange
operation), as mostly adopted practices using mod operator (GetRandom() % INTERVAL
) are very biased (it is well known, but I can also look for academic works on that matter). One good example is the C++11 random generator library, that has the concept of "distributions", like uniform_distribution, to operate over generators in a less-biased manner.[EDIT]:
In time, we should also DEFINITELY provide
Neo.Random.Shuffle
for arrays (and maybe...Neo.Random.Sort
, why not? To keep things "symmetric" 👍 ).Neo Version
Where in the software does this update applies to?
The text was updated successfully, but these errors were encountered: