FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Random Numbers in Software Are Not Random
NewsSecurity

Random Numbers in Software Are Not Random

via Dev.to TutorialMichael Lip2h ago

Math.random is not random. It is a deterministic algorithm that produces numbers that look random but are entirely predictable if you know the seed. For most applications this is fine. For security it is catastrophic. Pseudorandom vs. cryptographically secure Math.random() uses a pseudorandom number generator (PRNG). It is fast and produces a uniform distribution, but the sequence is deterministic. Given the same seed, it produces the same sequence every time. // Pseudorandom - fine for games, simulations, UI Math . random (); // 0.0 to 1.0 // Cryptographically secure - required for security crypto . getRandomValues ( new Uint32Array ( 1 ))[ 0 ]; crypto.getRandomValues() uses the operating system's cryptographic random source (like /dev/urandom on Linux). It is slower but unpredictable, making it suitable for generating passwords, tokens, and encryption keys. Generating random integers in a range The naive approach has a subtle bias: // Biased - do not use for anything important Math .

Continue reading on Dev.to Tutorial

Opens in a new tab

Read Full Article
0 views

Related Articles

Channels vs Mutexes: What should you really use
News

Channels vs Mutexes: What should you really use

Medium Programming • 19m ago

Rover Promo Codes and Deals: Get Up to $50 This Month
News

Rover Promo Codes and Deals: Get Up to $50 This Month

Wired • 24m ago

1XPLAY - India’s Biggest Gaming platform since 2015
News

1XPLAY - India’s Biggest Gaming platform since 2015

Medium Programming • 48m ago

UTC to PST/PDT Conversion Is Not Always Minus 8 Hours
News

UTC to PST/PDT Conversion Is Not Always Minus 8 Hours

Dev.to • 2h ago

Photo Filters Are Just Matrix Operations on Pixel Arrays
News

Photo Filters Are Just Matrix Operations on Pixel Arrays

Dev.to Tutorial • 2h ago

Discover More Articles