Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

Random number generator

How do I avoid overflows when trying to generate random numbers of the type

A*(seed) (modulo M)

with A = 80678
and M = 9706859

using a 32bit int on a pc

0
mattybat
Asked:
mattybat
  • 2
1 Solution
 
busukaCommented:
define both numbers as:
double A=80678.0, M=9706859.0
0
 
busukaCommented:
BTW, you can use "48 family": seed48, srand48, lrand48, etc. It uses
48-bit integer arithmetic.

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now