# Theoretical information about GH Random command

Hello all,

I am looking for information about the GH command “Random” for the documentation of my master thesis.
Unfortunately, the explanation only says that a pseudo random number is generated. I can’t find any information which specific type is used and according to which rule it is generated.
I don’t think anyone has the source code for this command, but maybe there is information about a paper or book that was used.

here you can see a picture of the random command I mean

It just uses the default `Random` implementation of .NET Framework.

The current implementation of the Random class is based on a modified version of Donald E. Knuth’s subtractive random number generator algorithm. For more information, see D. E. Knuth. The Art of Computer Programming, Volume 2: Seminumerical Algorithms . Addison-Wesley, Reading, MA, third edition, 1997.

and the code:

https://referencesource.microsoft.com/#mscorlib/system/random.cs,bb77e610694e64ca

You should use CNG random generator if randomness is really important.

I’m not one of the programmers but here is what I do know. The ‘pseudo-random’ function is designed to provide a repeatable set of ‘random’ numbers when the input is the same. That is to say, given an identical range (the top input), the output will always be the same for a given seed (the bottom input). The set of numbers does not change as the quantity (middle input) varies, the list just gets either longer or shorter.

The idea behind this is that for designers of algorithms creating geometry, if it was truly random, and you found the perfect solution after playing with the inputs for awhile, then you couldn’t do anything else - for any change would lose that solution… perhaps forever. So the thing is designed to consistently produce the same output given the same input.

As far as the source code, it certainly exists, but as to whether the algorithm is private intellectual property of McNeel or public I have no idea.

For a more truly random number generator, there are scripted solutions.

https://www.screencast.com/t/11nomORgEDp

@gankeyu
thank you very much for the information.
This should be sufficient for my proof of theory.

@Helvetosaur
thank you very much.
I know the functional relationships. I was only looking for “literature” evidence for the documentation of my thesis.