Skip to content

Conversation

@VictorGolenkov
Copy link

Было необходимо сгенерировать 2 случайные последовательности с помощью генераторов псевдослучайных чисел и проверить их с помощью тестов NIST. В папке binary_sequences содержится код для 1-го этапа лабораторной работы, в файле NIST_tests - для 2-го.
В модуле tools.py находятся функции для работы с json и txt файлами. Модуль main.py является точкой входа в программу и содержит в себе все необходимые вызовы функций, необходимые для выполнения задания. Файлы Report_C++ и Report_Java хранять отчёты, в соответствии с третьим этапом лабораторной работы.

@github-actions github-actions bot added In progress Код в процессе проверки Lab 2 Лабораторная 2 "Статистический анализ псевдослучайных последовательностей" labels Sep 9, 2025
lab_2/main.py Outdated
Comment on lines 33 to 38
if P >= 0.01:
check.append(True)
elif P < 0.01 or P >= 0:
check.append(False)
else:
raise ValueError("Получено некорректное значение P")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

используйте match/case

Comment on lines 32 to 35
if bit == '1':
S_n += 1
else:
S_n += -1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

замените на однострочную функцию

Comment on lines 118 to 120
M = 8

if N < 128:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

параметры: допустимая длина последовательности, длина блока - должны передаваться в функцию, в качестве параметров

Данный тест работает и для других размерностей последовательности. Подробнее можете посмотреть в документе NIST 800-22

Comment on lines 139 to 146
if max_n <= 1:
statistics[0] += 1
elif max_n == 2:
statistics[1] += 1
elif max_n == 3:
statistics[2] += 1
else:
statistics[3] += 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

используйте match/case

@Daria-creator-lab
Copy link

прочитайте файл readme п.5

lab_2/tools.py Outdated
Comment on lines 13 to 14
with open(file_name, 'r', encoding="utf-8") as f:
text: str = f.read()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

добавьте обработку исключений

@Daria-creator-lab Daria-creator-lab added Approved Код зачтен. Можно сдавать теорию. and removed In progress Код в процессе проверки labels Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved Код зачтен. Можно сдавать теорию. Lab 2 Лабораторная 2 "Статистический анализ псевдослучайных последовательностей"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants