tags:

views:

29

answers:

1

here is code of bigrand function in c code

int bigrand (){
 return  RAND_MAX* rand()+rand();
}

please tell me what is equivalent code in java?

A: 

java.util.Random is the Java SE random generator, with subclasses e.g. java.security.SecureRandom for a more cryptographically stronger generator.

API links

  • int nextInt(int n)
    • Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive)
  • double nextDouble()
    • Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0
polygenelubricants
@polygenelubricants random function i know but more deeply code which i have wrote how can i translate in java?
See the nextLong documentation on the same page, you'll want something similar depending on how big RAND_MAX was originally.
p00ya