Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crossplatform random number generator

Tags:

c#

random

When you need to be able to generate a random number from a seed, and guarantee it be the same number across different versions of the .NET Framework and Mono Framework, as-well as across different architectures (x86, x64), what do you do?

I'm presently considering storing millions of random bytes in a file for use as a temporary solution to this problem, but I think there's probably a better way (hopefully not too much more complicated).

like image 215
Mr. Smith Avatar asked Jun 13 '13 18:06

Mr. Smith


People also ask

Does Google have a random number generator?

The RAND function in Google Sheets generates a random number between 0 and 1 and can be used as a random number generator in Google Sheets. The RAND function outputs a decimal number between 0 and 1, for example, 0.2760773217.

Why is 17 the most common random number?

Seventeen is: Described at MIT as 'the least random number', according to the Jargon File. This is supposedly because in a study where respondents were asked to choose a random number from 1 to 20, 17 was the most common choice. This study has been repeated a number of times.

Can Google random number generator be hacked?

However, most of the RNGs are not truly random. They operate with a certain formula which can be figured out and used to predict the outcomes. The pseudo-randomness of some of these RNGs makes them vulnerable to attacks by hackers.

Is there an app to generate random numbers?

Random: All Things Generator is a random number generator with a sleek design and works with Android and iOS devices. The app is very simple since you can generate random numbers with the 'randomize' button. The randomizer generates random numbers as well as letters.


1 Answers

If you need a truly portable implementation, the best option would probably be to just use a custom random number generator, such as this Mersenne Twister implementation or Colin Green's Fast Random Number Generator. By controlling the implementation, you can guarantee that you'll get the same results given the same seed on any platform.

like image 52
Reed Copsey Avatar answered Sep 24 '22 01:09

Reed Copsey