Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
- Random Number Generator and Java

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

neil_pitman

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-06-2004
05:41 AM

68 Views

Random Number Generator and Java

I need a Random Number Generator that is:

1) certifiably random (NOT pseudo random)

2) has a Java Interface

3) can generate 1000 numbers per second of the format 1to N where N = {4,6, 136,144}

I know that I can get a C++ library and build my own Java interface. I also know that I can certify the implementation with a testing lab myself.

I simply want a one stop solution that provides me with a truly random stream of numbers accessible from Java. I don't mind being tied to an Intel board or processor.

Does anyone have some ideas? I cannot be the first person who needed a random number generator in Java.

Thanks,

Neil

Link Copied

3 Replies

Intel_C_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-06-2004
05:20 PM

68 Views

Neil,

Thanks for joining the MKL forum. I am asking the developers for VSL, the MKL statistical library includign random number generators, to respond to you inquiry.

Bruce

jd_weeks

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-06-2004
10:36 PM

68 Views

Truly random RNG's hardly exist, partly because it's extremely difficult to make sure they are truly random. One approach that has been used is to look at a low-order bit in the system clock, but that has the drawback that your code may execute faster than the clock, giving you correlated bits. Also, if there is any synchronicity between the system clock and the processor's clock you can get into trouble.

I see your e-mail address is "mahjongmania.com" so I presume that you need this for randomizing a shuffle in a game (presumably mah jong :). For these sorts of purposes, a psuedo-random generator usually is fine. If you are worried about repeat times or correlations, you might want to look into the Mersenne Twister RNG (http://www.math.sci.hiroshima-u.ac.jp/%7Em-mat/eindex.html).

You can make sure a RNG doesn't give the same sequence on different start-ups by initializing it using something like the system clock, which is very likely to be different every time someone starts up your application.

Hope this helps,

John Weeks

Andrey_N_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-12-2004
01:48 PM

68 Views

Software implementations of random number generators generate deterministic and periodic sequences of numbers. Thus such sequences can be hardly called random. In fact, such implementations just imitate randomness. Wording pseudo-random accentuates deterministic nature of a sequence rather than emphasizes bad random properties of the generator.

There are many software implementations of random number generators, and it's impossible to recommend particular RNG as the best one. All RNGs differ in their properties (period length, speed, uniformity measures like equidistribution and discrepancy as well as ... unpredictability). I would say that user application defines requirements to RNGs. For instance, some Monte Carlo methods (like MC integration) require just filling a space of required dimension as even as possible and don't require independence between random vectors. There are generators specially designed for such purposes. They are called quasi-random number generators.

For majority of applications utilizing random numbers it's sufficient to use pseudorandom number generators. In contrast to quasi-random ones they imitate independence as well. I would recommend trying pseudo-or quasi-random number generator solutions from Intel Math Kernel Library. In particular, MKL provides comprehensive documentation discussing RNG applicability aspects, theoretical properties, performance measurement results and empirical testing results for each RNG available in MKL. Perhaps you can find there something applicable to you.

If Java implementations are the most preferable to you, however, I would recommend following links:

1) One of the best pseudo-random number generators (Mersenne Twister)

(Java versions of the generator can be found at

2) You may want to look at Java package RngPack. It has some RNGs including Mersenne Twister (

3) You may find also interesting links at

One of RNG properties might be important (i.e. in cryptography) is unpredictability of the output. This means that without knowledge about RNG algorithm and looking only on previously generated output an observer cannot predict next number with probability higher than 50%. Unfortunately there is no proven algorithm satisfying such a requirement. Output of most of pseudo-random number generators can be _relatively_ easy predicted.

Regarding to true randomness. There are specially designed physical devices which output is a combination of an analog noise and a deterministic algorithm. I would recommend following link

A little bit more about "true" randomness. Pseudorandom number generators can be rather unpredictable if you will reinitialize them from time to time using processor clock. The only recommendation is to do this relatively rare (much rarely than the rate of a processor clock).

Andrey

For more complete information about compiler optimizations, see our Optimization Notice.