예제 #1
0
    def stat_selector(self, value, level):

        values = int(
            ((value * 2 +
              randomNum.RandomNum().random_num(self.INDIVIDUAL_VALUE) +
              randomNum.RandomNum().random_num(self.BASE_VALUE) / 4) * level /
             100 + 10 + 5) * self.CHARACTER_VALUE)

        return values
예제 #2
0
    def hp_selector(self, hp_value, level):

        hp_values = int(
            (hp_value * 2 +
             randomNum.RandomNum().random_num(self.INDIVIDUAL_VALUE) * 2 +
             randomNum.RandomNum().random_num(self.BASE_VALUE) / 4) * level /
            100 + 10 + level)

        return hp_values
예제 #3
0
    def ability_selector(self, ab1, ab2, ab3):
        ability = ""
        try:
            np.isnan(ab2)
            arr = [0, 1, 2]
            rate = [0.95, 0, 0.05]
        except Exception:
            arr = [0, 1, 2]
            rate = [0.5, 0.45, 0.05]
        if arr[randomNum.RandomNum().random_index(arr, rate)] == 0:
            ability = ab1
            # print("草丛中冒出了一只普通特性1:%s" % ability)
        if arr[randomNum.RandomNum().random_index(arr, rate)] == 1:
            ability = ab2
            # print("草丛中冒出了一只普通特性2:%s" % ability)
        if arr[randomNum.RandomNum().random_index(arr, rate)] == 2:
            ability = ab3
            # print("草丛中冒出了一只隐藏特性:%s" % ability)

        return ability
예제 #4
0
 def individual_selector(self):
     return randomNum.RandomNum().random_individual_value(
         self.INDIVIDUAL_VALUE)
예제 #5
0
eps = 10**-5

for i in newton.Newton(f, x0, eps):
    print(i)

print("\n\nRandom numbers iterator")
m = 2**31 - 1
a = 7**5
c = 0
x0 = 1
maxNum = 10**5

squareIter = [0] * 10
sguareGen = [0] * 10

r = randomNum.RandomNum(m, a, c, x0)
for i in range(maxNum):
    x = next(r) / m
    y = next(r) / m

    xP = random.random()
    yP = random.random()

    for idx in range(1, len(squareIter) + 1):
        if x <= idx * 0.1 and y <= idx * 0.1:
            squareIter[idx - 1] += 1
        if xP <= idx * 0.1 and yP <= idx * 0.1:
            sguareGen[idx - 1] += 1

print(squareIter)
print("\nPython random numbers")