Skip to content

Instantly share code, notes, and snippets.

@radeksvarz
Created May 13, 2020 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radeksvarz/61b99c26ec5d7fce221d3e2f9e3be38a to your computer and use it in GitHub Desktop.
Save radeksvarz/61b99c26ec5d7fce221d3e2f9e3be38a to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
from pylab import rand, ylim, xlim
from random import randint
import numpy as np
# random.randint(a, b) # Return a random integer N such that a <= N <= b.
def onGenerate():
x = randint(0,5)
y = randint(1, 6-x)
return [[x, y, x + y], [y, x, x + y]][randint(0, 1)]
X = []
Y = []
for i in range(100):
a, b, c = onGenerate()
X.append(a)
Y.append(b)
plt.scatter(X,Y, color='r', alpha=0.1)
plt.xlabel("X")
plt.ylabel("Y")
# ylim([-1,6])
# xlim([-1,6])
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment