Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I had read someone's blog that the high precision random number is hard to get, he said if we want to get a chance in a million, using :
Random(1,1000)*Random(1,1000) < 2 is better than Random(1,1000000)<2
( we suppose Random(1,n) generate integer numbers between 1 to n )
theoretically, the probilities of two are the same, but what's different action of those expression in a real program? for example rand() function in standard C language, and please give more information.
What you probably want by asking for 'high-precision' is a cryptographically secure pseudorandom number generator, that is, one with a high enough entropy that it's certifiably random enough for high security applications. LavaRnd is one of these, if you provide it with a lens capped webcam (ideally a webcam in a box completely devoid of light) for input.
Another cryptographically sound algorithm is Blum-Blum-Shub, but it's very slow. You could also take a look at Fortuna.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
As the title says, is it possible?
No, this isn’t possible. There are several ways you can encode “the set of all prime numbers” as a language, and the standard ways of doing so (writing the number out in binary, writing out a number of tally marks equal to the number, etc.) aren’t regular.
Formally proving this is a bit tricky but is doable using either the pumping lemma for regular languages or the Myhill-Nerode theorem. The crux of the arguments boil down to the fact that replicating parts of prime numbers repeatedly will eventually give you a non-prime number, and that’s where the technical details of the proofs come in.
Hope this helps!
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Suppose I have 8 bits. Then total possible combinations would be 2^8 . Is there some encryption technique I could use so that I can identify all those 256 numbers with less bits ( say 5 or 6 bits). I know this is kind of hard ( and impossible ) . But if someone could help.
No, this is not possible.
At least 2 of the original 256 states would be mapped to the same encoded state. Therefore you cannot reconstruct the original stated from the encoded state.
see Pigeonhole principle
According to the pigeonhole principle there's no there's no way to stuff 8 bits of information in 5 or 6 without loss of data.
With larger sets of data you can use lossless compression techniques to reduce the amount of data needed, but those techniques have overhead that would take more information than could be saved from just 8 bits.
The only way you can compress 8 bits is to restrict the data set so that patterns can be encoded. e.g. if exactly one of the first two bits can be 1 then you can "encode" that to save one bit, but that limits the number possible values to
2^7.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'm a bit mathematically challenged and have been working on the RSA cipher (good start). I can find the public and private keys and know how to work do modulo operations on a calculator. The problem is that I can't do them when the numbers get to high. For example say I have:
10^541 mod 2923 = C
The numbers involved here become very large and don't display fully on a calculator, if it can even handle the numbers (mine is crap). What I am wondering is if there is a better method to work out the ciphertext or plaintext that will work for largish numbers.
I think http://math.stackexchange.com would be a better place for this question.
But, essentially, don't save the mod for the end. Break the exponentiation up into many smaller operations with mod after each one.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I'm looking to implement an ELO ranking system. I've read the wikipedia articles and I'm confused about the start rank for players who enter the system at a later point. The common solution is to use a provisional ranking system but I'm curious if anyone can point me to specific numeric details:
what K value do new players get?
how long does a player stay in provisional mode?
how does K value change as rank changes?
I'm sure there are many variations, I'd just like to know actual numbers for a system that someone has implemented successfully.
Thanks for your time.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I heard this a lot when talking about software engineering and abstract data types, what does this do? Can anyone give me a concrete example of this concept?
A representation invariant is a condition concerning the state of an object. The condition can always be assumed to be true for a given object, and operations are required not to violate it.
In a Deck class, a representation invariant might be that there are always 52 Cards in the deck. A shuffle() operation is thus guaranteed not to drop any cards on the floor. Which in turn means that someone calling shuffle(), or indeed any other operation, does not need to check the number of cards before and after: they are guaranteed that it will always be 52.