Giter Site home page Giter Site logo

Replace the PRNG about inkjs HOT 10 OPEN

y-lohse avatar y-lohse commented on August 25, 2024
Replace the PRNG

from inkjs.

Comments (10)

joethephish avatar joethephish commented on August 25, 2024

Note: I'd be very happy to use a simple-as-possible custom PRNG in C# to
make ports simpler. (But prob wouldn't have time to implement it myself,
but might be happy to back port if you started with a JS version?)

On 21 September 2016 at 21:03:38, Yannick Lohse ([email protected])
wrote:

Align the PRNG in inkjs with the C# version so the randomness is the same
on all platforms.
The C# version can be found here.
http://referencesource.microsoft.com/#mscorlib/system/random.cs,bb77e610694e64ca

If someone with an up and running C# env wants to tackle this one, feel
free to grab it!


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#31, or mute the thread
https://github.com/notifications/unsubscribe-auth/AA0bVyCzrElU6UQXphkgpATGFUmDtqMdks5qsY2agaJpZM4KDODk
.

from inkjs.

y-lohse avatar y-lohse commented on August 25, 2024

Well, inkjs currently uses this one, if you want to have a look at it. They hardly come simpler than that :-)

from inkjs.

joethephish avatar joethephish commented on August 25, 2024

Yup, looks ideal! Let's do that then.

On 21 September 2016 at 21:17:14, Yannick Lohse ([email protected])
wrote:

Well, inkjs currently uses this one
https://gist.github.com/blixt/f17b47c62508be59987b, if you want to have
a look at it. They hardly come simpler than that :-)


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#31 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AA0bVwRZQLg5G-AstnAdFDXzHNkkgaWCks5qsZDKgaJpZM4KDODk
.

from inkjs.

curiousdannii avatar curiousdannii commented on August 25, 2024

If you want a super simple PRNG then I'd recommend Xorshift. It usually scores better on tests than LCGs.

from inkjs.

NQNStudios avatar NQNStudios commented on August 25, 2024

@joethephish @y-lohse Is this feature still in any demand? It seems like something good I could tackle to learn more about RNG implementation.

from inkjs.

y-lohse avatar y-lohse commented on August 25, 2024

Not sure! I'm going to take a wild guess here and say that @joethephish would still like to switch the PRNG in ink, but is busy creating a game.
Switching inkjs to the C# implementation is still an option, but I'm not sure there's really a demand for it. But if you feel like working on it, the PR would be welcome :)

from inkjs.

joethephish avatar joethephish commented on August 25, 2024

I'm in favour of both having a super simple/lightweight (but effective!) implementation that's the same for both. But yeah, it's not a huge priority for me, but having consistency between CS#/JS would be cool!

from inkjs.

curiousdannii avatar curiousdannii commented on August 25, 2024

I used this in an Inform project when I wanted reproducible cross platform random seeds. The third one is called xorshift* and is extremely reliable for the code size - only one word of state and 7 operations!

https://gist.github.com/Marc-B-Reynolds/0b5f1db5ad7a3e453596

I'd be happy to do up PRs for both implementations if you'd be interested.

from inkjs.

y-lohse avatar y-lohse commented on August 25, 2024

Sounds good to me :)

from inkjs.

curiousdannii avatar curiousdannii commented on August 25, 2024

It doesn't appear that nextFloat is ever used, do we need to keep it?

Hmm, could either of you help me by explaining briefly how NextSequenceShuffleIndex works?

Edit: I think I mostly understand. You're not storing the actually shuffled list, so you have to recreate it based on the hash of the container and the storyseed. That means the whole thing will change if SeedRandom is called, right?

from inkjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.