We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
突然想到,若總組合數實在太大,k 無法用 int 表示出來,那這個方法也是不合用的 在此情況,可以使用下列的 code (總組合要遠大於 n ,不然一直沒加成功會很慢)
def gen_n_random_combinations( entities: List[List[str]], n: int, ) -> List[List[str]]: assert all(entities) ids_set = set() while len(ids_set) < n: ids_set.add( tuple( random.randint(0, len(e) - 1) for e in entities ) ) result = [[e[i] for e, i in zip(entities, ids)] for ids in ids_set] return result
The text was updated successfully, but these errors were encountered:
stegben
SoluMilken
No branches or pull requests
突然想到,若總組合數實在太大,k 無法用 int 表示出來,那這個方法也是不合用的
在此情況,可以使用下列的 code (總組合要遠大於 n ,不然一直沒加成功會很慢)
The text was updated successfully, but these errors were encountered: