Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better RNGs #47

Closed
DonaldTsang opened this issue Sep 17, 2020 · 7 comments
Closed

Better RNGs #47

DonaldTsang opened this issue Sep 17, 2020 · 7 comments

Comments

@DonaldTsang
Copy link

DonaldTsang commented Sep 17, 2020

To those that insists that "the dice is not random!" maybe there are ways of taking entropies from:

  • camera
  • microphone
  • gyroscope
  • screen activity

And yes that is important for TRPG players.

Another issue regarding RNGs https://en.wikipedia.org/wiki/List_of_random_number_generators

And for tests https://stackoverflow.com/a/27160492

@cauerego
Copy link

cauerego commented Jan 4, 2021

the wikipedia link is spot on! the crap overflow (long story what i mean by crap here) one, not so much.

this is important to so much more than just rpg, cryptography, banks, and ai... but i rather not get into details here.

just wanted to give a special thanks for the link, donald.

and reinforce how amazing and way overlooked /dev/urandom is! just learned about it today, thanks to ya! 🥰

and, from your first link, got many better links for knowing which one works (don't even need to test):

https://en.m.wikipedia.org/wiki//dev/random the many links are here.

https://www.2uo.de/myths-about-urandom/ might be all you need to know, summarized.

edit: any dedicated rng program should offer 2 options. a blocking option (that might mean /dev/random if you're not in freebsd) and the non blocking one. i like to argue the blocking one should be default. because when we actively seek for randomness we also want one concept that haven't been brought up anywhere i've read about true randomness: locality. it's also not related to the physical quantum term. or anything i could read anywhere. reason why i keep trying to write about it.

cheers! 😘

@DonaldTsang
Copy link
Author

@cauerego I mean caca overflow is usually bad, but having every testing suite in one place is just convenient TBH.
Otherwise, thanks for the info brother, this is really useful!

@Gear61
Copy link
Owner

Gear61 commented Jan 5, 2021

This app is for casual use, and I haven't gotten many complaints about simple Math.rand(). I also can't find a smooth RNG library for Java/Kotlin within all these links.

@Gear61 Gear61 closed this as completed Jan 5, 2021
@cauerego
Copy link

cauerego commented Jan 5, 2021

@Gear61 thanks for the feedback!

library? you could just call it straight up... or use SecureRandom:

https://stackoverflow.com/a/58182522/274502 (donald, u might enjoy this link, found it thanks to gear)

you shouldn't work based on complaints only... 🤣

and the beauty of life is basically casual! 😘

@Gear61
Copy link
Owner

Gear61 commented Jan 9, 2021

@cauerego Feel free to submit a PR. From my end, this app is in maintenance mode as I'm focusing on other apps. If there isn't clear user value, then there's other things worth working on as you can always improve any product in infinite ways.

If you do submit a PR, please do profiling to make sure it doesn't regress the performance of the app: https://kostenko.org/blog/2019/04/java-spedup-random-generation.html

@cauerego
Copy link

well, i tried.

this patch should work without issues:
https://github.com/Gear61/Random-Number-Generator/compare/master...cauerego:patch-1?expand=1

but gradle didn't work as expected, even for master:
https://github.com/cauerego/Random-Number-Generator/actions/runs/506351445

this is as far as i could go today, working with nothing but a cellphone, so i couldn't really test it.

#50

@cauerego
Copy link

cauerego commented Nov 2, 2021

anyway...

since this apparently won't go anywhere, if anyone also feel the need for better randomness, i advise to use the terminal (in android, i use termux):

shuf -i 0-100 -n 1 --random-source=/dev/urandom

now this can pretty much do all the same things as the app...

but i still want to improve it, and make it keep trying random numbers until it reaches a pre selected number or range, and then pick on the lotto!

if i don't edit this one enough to include this complex command or script, please, do nag me... or even better, include it yourself!! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants