This commit is contained in:
guanjihuan 2024-01-04 18:45:58 +08:00
parent 44c83bb056
commit 5e4961593e
3 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,7 @@
[metadata] [metadata]
# replace with your username: # replace with your username:
name = guan name = guan
version = 0.1.71 version = 0.1.72
author = guanjihuan author = guanjihuan
author_email = guanjihuan@163.com author_email = guanjihuan@163.com
description = An open source python package description = An open source python package

View File

@ -1,6 +1,6 @@
Metadata-Version: 2.1 Metadata-Version: 2.1
Name: guan Name: guan
Version: 0.1.71 Version: 0.1.72
Summary: An open source python package Summary: An open source python package
Home-page: https://py.guanjihuan.com Home-page: https://py.guanjihuan.com
Author: guanjihuan Author: guanjihuan

View File

@ -724,6 +724,12 @@ def preprocess_for_parallel_calculations(parameter_array_all, cpus=1, task_index
parameter_array = parameter_array_all[task_index*num_parameter:num_all] parameter_array = parameter_array_all[task_index*num_parameter:num_all]
return parameter_array return parameter_array
# 根据子数组的第index个元素对子数组进行排序index从0开始
@guan.statistics_decorator
def sort_array_by_index_element(original_array, index):
sorted_array = sorted(original_array, key=lambda x: x[index])
return sorted_array
# 随机获得一个整数,左闭右闭 # 随机获得一个整数,左闭右闭
@guan.statistics_decorator @guan.statistics_decorator
def get_random_number(start=0, end=1): def get_random_number(start=0, end=1):