seedfaker-core 0.4.0-alpha.1

Core library for seedfaker — deterministic synthetic generator for realistic, correlated, and noisy test records
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::ctx::GenContext;

// Format: Stripe API Key — https://docs.stripe.com/keys
pub fn gen(ctx: &mut GenContext<'_>, buf: &mut String) {
    let arr = ["live", "test"];
    let mode = arr[ctx.rng.urange(0, arr.len() - 1)];
    let len = ctx.rng.urange(24, 40);
    // "sk_" (3) + mode(4) + "_" (1) + alnum(len)
    buf.reserve(8 + len);
    buf.push_str("sk_");
    buf.push_str(mode);
    buf.push('_');
    ctx.rng.push_alnum(buf, len);
}