Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def congruence(x):
- list_nums = []
- list_index = []
- for index in range(x):
- m = random.randint(1, 1000) * 2
- a = random.randint(1, 1000) * 2 + 1
- x0 =random.randint(1, 1000) * 2 + 1
- x_i = (a * x0 - 1) % m
- r_i = x_i / m
- print( r_i, index)
- list_nums.append(r_i)
- list_index.append(index)
- return list_nums, list_index
- def random_(x):
- list_nums = []
- list_index = []
- for index in range(x):
- m = random.random()
- print(m, index)
- list_nums.append(m)
- list_index.append(index)
- return list_nums, list_index
- tuple_cords_congruence = congruence(int(input('Конгруэнтный метод. Введите число: ')))
- tuple_cords_random = random_(int(input('Рандомный метод. Введите число: ')))
- print(tuple_cords_congruence)
- print(tuple_cords_random)
Add Comment
Please, Sign In to add comment