Timeline for Random Golf of the Day #7: A distinctly random character
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 12, 2021 at 10:33 | comment | added | maxb |
I found something that works... ▄v±√i§ , saving exactly 0 characters.
|
|
May 12, 2021 at 8:35 | comment | added | maxb |
You're right, I just tried it and noticed that the residues weren't distributed over all 26 possible values. I tried some different things (like the cube/factorial/fibonacci operators), but I haven't had any luck yet. Trying to analyze vv* now (one byte longer, but should avoid some of the issues above)
|
|
May 12, 2021 at 8:28 | comment | added | Kevin Cruijssen |
@maxb Unless I'm doing something wrong myself, I'm pretty sure some of the letters will never be output. If we square and then modulo-26, range [0,25] will result in [0,1,4,9,16,25,10,23,12,3,22,17,14,13,14,17,22,3,12,23,10,25,16,9,4,1] , but so will range [26,51] , [52,77] , etc. It's a repeating pattern apparently. Those integers will the only possible outputs, so some letters (i.e. 2=c ) will never be output, and the letters that do output have in most cases overlapping probabilities.
|
|
May 12, 2021 at 7:55 | comment | added | maxb |
I haven't done the exact math on this, but since indexing repeats for indices that are higher than the length of a string/array (e.g. "abcd"9§ gives "b" ), you could do something like ▄v²§ (link). Basically, get a random 32 bit integer, square it to skew the probabilities, and index the alphabet using the skewed random integer.
|
|
Feb 17, 2021 at 15:37 | history | answered | Kevin Cruijssen | CC BY-SA 4.0 |