Last active
August 29, 2019 17:42
-
-
Save ynaoto/8f8bba207fe5c139daf51590ed7b0134 to your computer and use it in GitHub Desktop.
ハッシュ三種(processing.py)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def setup(): | |
size(1000, 800) | |
background(255) | |
strokeWeight(3) | |
xmax = 1000000 | |
ymax = 0 | |
def p(x, y): | |
global ymax | |
ymax = max(y, ymax) | |
gx = map(x, 0, xmax, 0, width) | |
gy = map(y, 0, ymax, height, 0) | |
point(gx, gy) | |
def draw(): | |
fill(255,10);noStroke();rect(0,0,width,height) | |
b32 = 2**32 | |
for i in range(100): | |
x = int(random(xmax)) | |
y = x | |
y = ((y >> 16) ^ y) * 0x119de1f3 % b32 | |
y = ((y >> 16) ^ y) * 0x119de1f3 % b32 | |
y = (y >> 16) ^ y % b32 | |
stroke(255, 0, 0) | |
p(x, y) | |
y = x | |
y = ((y >> 16) ^ y) * 0x45d9f3b % b32 | |
y = ((y >> 16) ^ y) * 0x45d9f3b % b32 | |
y = (y >> 16) ^ y % b32 | |
stroke(0, 255, 0) | |
p(x, y) | |
y = x*2654435761 % b32 | |
stroke(0, 0, 255) | |
p(x, y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment