You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've written the following very simple utility macro to generate proabilistic fake data for a project and thought other people might find it interesting. It doesn't make sense to package such a simple macro but it might make sense to include it in a larger package such as Faker. The implementation speaks for itself:
It saves you from writing something like the following and makes the intent clearer
# Is the first outcome success or failure? should it be < or >?if:rand.uniform()<probdo# something in case of successelse# something in case of failureend
In practice I'm using it for things like:
gender=with_probability0.35do:femaleelse:maleend
What do you think about including something like this in Faker?
The text was updated successfully, but these errors were encountered:
I've written the following very simple utility macro to generate proabilistic fake data for a project and thought other people might find it interesting. It doesn't make sense to package such a simple macro but it might make sense to include it in a larger package such as
Faker
. The implementation speaks for itself:You use it like this
It saves you from writing something like the following and makes the intent clearer
In practice I'm using it for things like:
What do you think about including something like this in Faker?
The text was updated successfully, but these errors were encountered: