Gear61 / Random-Number-Generator

A clean, simple random number generator for Android. Downloaded 180,000+ times and rated 2,000+ times on Google Play with 4.7+ average rating.
39 stars 24 forks source link

Better RNGs #47

Closed DonaldTsang closed 3 years ago

DonaldTsang commented 4 years ago

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

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 commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

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.

cauerego commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

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!! 😁