Skip to content

Conversation

kamilogorek
Copy link
Contributor

Fixes #1625

@getsentry-bot
Copy link
Contributor

Messages
📖

✅ TSLint passed

📖

@sentry/browser gzip'ed minified size: 21.4316 kB

Generated by 🚫 dangerJS

@kamilogorek kamilogorek merged commit a2f2a57 into master Oct 8, 2018
@kamilogorek kamilogorek deleted the fix-sample-rate branch October 8, 2018 10:37
if (typeof sampleRate === 'number' && sampleRate > Math.random()) {
// 1.0 === 100% events are sent
// 0.0 === 0% events are sent
if (typeof sampleRate === 'number' && Math.random() > sampleRate) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as i know Math.random() is not a valid random generator
i think better to use some kind of the https://github.com/ckknight/random-js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, it's not security-grade randomness, but it'll do just fine for sampling :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants