Can someone tell me the formula codes of how to
1 find and write the total number of massive elements om massive number(random massive numbers)
2 find and write the biggest random massive number(random massive numbers)
3 find and write the smalles random massive number(random massive numbers)
4 how to make a random a unique number
Nikusha.Kalatozi
- 3 Contributors
- forum2 Replies
- 11 Views
- 2 Years Discussion Span
- comment Latest Post by JOSheaIV
ddanbe 2,720
What is a massive number?
JOSheaIV 119
It really depends on how masssive of a number we are talking. For instance a Double
can handle up to 1.7 × 10^308 as its largest size. Which can work for most people. To find the largest or smallest value, you can use bitwise logic like is one value greater then the other, ext.
However, if that number just won't cut if for you, then there is the BigInteger
, located within the System.Numerics
namespace. The number from what I can tell really only has the size limit of a byte array's max index (from what I can tell it's like a wrapper for a byte array that represents REALLY big numbers). To be honest you probably won't need this unless you are doing complex math, like encryption algorithms (only time I've ever used it). But if you do it does have functions like BigInteger.Max
and BigInteger.Min
that you pass in two BigIntegers to find which one is larger or smaller depending on what you use.
Now when it comes to random, there really is no such thing when it comes to computers, or it's almost impossible. Pseudorandom, as its called, is about the most random a computer can get. To achieve this is not always the easiest task. You usually have to have a good source of Entropy, or randomness, that you can use such as a seed for a random number generator. Some application populate this pool of entropy with things like time a mouse moves, or its movement, a keyboard stroke, hard drive access time, ext. Pieces that are random because the user triggered them.
However, for C#, there has only been one way so far I have found to tap into a good source of Entropy and produce random numbers. There is a library out there called RandomOps (here's the link http://www.hvass-labs.org/projects/randomops/cs/). The user has developed a very nice .NET 4 library to produce random numbers. However, off the bat, I wouldn't consider them to be Pseudorandom worthy (trust me I've seen patterns). However, the developer did add a piece to the code that can allow you to seed the random number generator from an Entropy source from Random.Org (just be aware they limit you to 1 million bits a day of entropy unless you pay). Anyway, he has a guide on his site (a pdf) for how to access this feature. Follow the guide and you should be good (I have set this up myself if you still need help I can offer some code)
By the way, Random.Org gets its randomness from recievers that pick up radio waves (you can read up more on their website)
Of course your question was rather vague, so I can really only answer so much. If you give me more details I can more then help