跳转到主要内容

生成指定模式的随机字符串

项目描述

这是一个生成随机字符串的小模块,可按给定模式生成。它还可以估算此模式的各种度量(碰撞概率、估计碰撞次数和总变体数)。

安装

$ pip install funny-codes

使用方法

>>> from funny_codes import FunnyCodes
>>> my_codes = FunnyCodes('TATAN-76')
>>> my_codes.next() # the following is a random code matching the pattern
HIPAS-12

>>> my_codes.next()
MOVER-87

>>> my_codes.variants_count()
20000844

>>> my_codes.collision_prob(1000)
0.024664677603280283

>>> my_codes.expected_collisions(10000)
2.499235797673464

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面