Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Sets RNG_Random_Bit to either 0 or 1 with a 50% chance for each.
- execute if predicate charlottebuff:coin_flip run scoreboard players set RNG_Random_Bit rng 1
- # Multiplies RNG_Random_Bit with the current RNG_Shift_Index to produce a bit mask (that's not the right word) with the previous value of RNG_Random_Bit at the current position and 0 everywhere else.
- scoreboard players operation RNG_Random_Bit rng *= RNG_Shift_Index rng
- # Adds the aforementioned bit mask to the RNG_Output, producing one binary digit of randomness.
- scoreboard players operation RNG_Output rng += RNG_Random_Bit rng
- # RNG_Shift_Index is doubled (or shifted left once, if you will) to advance the active position by one step.
- scoreboard players operation RNG_Shift_Index rng += RNG_Shift_Index rng
- # RNG_Random_Bit is cleared for the next loop iteration
- scoreboard players set RNG_Random_Bit rng 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement