Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,20 @@ In this section the "installation" and usage of Samply.Laplace is described.
To use Samply.Laplace in your project, please include the following dependency in your `Cargo.toml`:

```
laplace_rs = {version = "0.2.0", git = "https://github.com/samply/laplace-rs.git", branch = "main"}
laplace_rs = {version = "0.6.0", git = "https://github.com/samply/laplace-rs.git", branch = "main"}
```

### Example Usage

Using Samply.Laplace library:

```rust
use laplace_rs::{ObfCache, get_from_cache_or_privatize, Bin, ObfuscateBelow10Mode};
use laplace_rs::{ errors::LaplaceError, ObfCache, get_from_cache_or_privatize, ObfuscateBelow10Mode};

const DELTA: f64 = 1.;
const EPSILON: f64 = 0.1;
const MU: f64 = 0.;
const ROUNDING_STEP: usize = 10;
const domain_limit = None;
const DOMAIN_LIMIT = None;


fn obfuscate -> Result<u64, LaplaceError> {
Expand All @@ -56,7 +55,7 @@ fn obfuscate -> Result<u64, LaplaceError> {
false, // A flag indicating whether zero counts should be obfuscated.
ObfuscateBelow10Mode::Ten, // 0 - return 0, 1 - return 10, 2 - obfuscate using Laplace distribution and rounding
ROUNDING_STEP, // The granularity of the rounding.
domain_limit, // Optional limitation to the domain of the Laplace distributions
DOMAIN_LIMIT, // Optional limitation to the domain of the Laplace distributions
&mut rng, // A secure random generator for seeded randomness.
)?;

Expand Down