# .font: font.text_2
# .autowrap: false
# .centered: true
Back to Classics 23
# .font: font.text_1
by
# .font: font.text_2
DarkStoorM
# .centered: false

# .font: font.value_1
# .autowrap: false
DARKSTOORM                        2020-07-13 00:34
# .font: font.value_2
# .autowrap: true
ALGORITHM: MULBERRY32  
  
SEED: 64  
  
RANDOM FILL:   
- BOULDER: 33  
- DIRT: 44  
- MAGIC WALL: 45  
- SPACE: 79  
- TITANIUM WALL: 81  
- DIAMOND: 86  
- FIREFLY: 87  
- BUTTERFLY: 88

# .font: font.value_1
# .autowrap: false
NESDORI                           2020-07-13 12:29
# .font: font.value_2
# .autowrap: true
IT'S QUITE AMAZING HOW SIMPLE MULBERRY32 PRNG IS AND IT STILL HAS A CYCLE LENGTH OF ALL POSSIBLE STATES (2 TO THE POWER OF 32). IT ALSO DOES WELL IN TEST SUITES. 64-BIT THRUST PRNG WHERE MULBERRY32 IS BASED IS EVEN MORE SIMPLER BUT TEST RESULTS ARE NOT AS GOOD AND THERE ARE RESTRICTIONS FOR SEEDS.

# .font: font.value_1
# .autowrap: false
DARKSTOORM                        2020-07-13 13:32
# .font: font.value_2
# .autowrap: true
HM... I THINK I'VE MADE A MISTAKE. I WAS LOOKING FOR GENERATING A NUMBER WITH MULBERRY32 FROM A SPECIFIC RANGE, AND THE SOLUTION I FOUND WAS TO DIVIDE THE RESULT BY 0X100000000, THEN MULTIPLY BY MAX_NUMBER+1 AND TAKE THE FLOOR(). I DID NOT VERIFY IF THAT'S EVEN THE CORRECT WAY TO UTILIZE THIS FUNCTION, BUT IT SEEMS TO GENERATE THE 0-255 NUMBERS CORRECTLY. THE NEXT NUMBER USES THE GENERATED NUMBER AS A SEED FOR THE NEXT GENERATION.  
  
I DON'T LIKE THE "LOOKS LIKE IT WORKS, SO IT PROBABLY WORKS" WAY AND I'M AFRAID I DID SOMETHING WRONG.  
  
THIS WAS THE SOLUTION FOR JAVASCRIPT AND I'M ALSO AFRAID THAT WHEN I WILL TRY TO IMPLEMENT IT IN MY C# PROJECT, THE RESULTS WILL BE OFF :D OH WELL, IT'S ALWAYS SOME EXPERIENCE!

# .font: font.value_1
# .autowrap: false
NESDORI                           2020-07-13 15:28
# .font: font.value_2
# .autowrap: true
darkstoorm, SOUNDS COMPLICATED :) YOU SHOULD SEED THE RNG JUST ONCE, NOT WITH THE RESULTS ANYMORE. THEN THE RNG WORKS LIKE IT'S INTENDED AND RANDOM VALUES ARE MORE RANDOM. AND BECAUSE YOU WOULD LIKE TO GET VALUE BETWEEN 0-255 WHICH IS EXACTLY 8 BITS YOU DON'T HAVE TO DO COMPLICATED CALCULATIONS, JUST DO: VALUE &AMP; 0XFF :)

# .font: font.value_1
# .autowrap: false
DARKSTOORM                        2020-07-13 15:59
# .font: font.value_2
# .autowrap: true
AHHHH! I REALIZED I ACTUALLY DID IT WRONG. IN FACT, EVERY ALGORITHM I USED IS WRONG, BECAUSE I USED THE RESULT NUMBER AS A SEED... I SHOULD NOT DO THAT. THANK YOU nesdori! ALSO: VALUE &AMP; 0XFF WORKS GREAT  
  
I RECHECKED THE FUNCTION AND I MISSED ONE IMPORTANT THING:  
  
UINT32_T Z = (X += 0X6D2B79F5UL); // X = STATE  
  
I MISSED THE PART WHERE X IS DIFFERENT WITH EACH CALL... I THOUGH I HAVE TO RE-SEED IT WITH THE RESULT, WHICH WAS WRONG! :D I WAS LOOKING AT THE C64 PRNG AND I THOUGHT THE RESULT IS THE SEED.  
NOW, ALL THE GENERATED CAVES ARE USING THE WRONG DATA, BUT I THINK IT WAS A GOOD EXPERIENCE! AT LEAST THE C64 WORKS AS INTENDED.  
  
ONCE I GET BACK I WILL FIX THE ALGORITHMS AND COMPARE THE NUMBERS DISTRIBUTION.  
  
I WAS PRAYING TO GET THE SAME RESULTS, BUT THE DATA WAS DIFFERENT... WELL, THAT'S WHAT I GET :D