Anyone know a way to convert that to how many digits (ie x in 10^x) that number would have?
Last edited by Lebanese Dragon; 12-28-2012 at 10:38 PM.
I'm not quite sure what Lebanes Dragon is trying to do here.
Simply use the decadic logarithm on the number, round it down (i.e. floor) and increment by one.
In Excel that would be: FLOOR.MATH(LOG10(number))+1
Last edited by Khendraja'aro; 12-28-2012 at 11:43 PM.
When the stars threw down their spears
And watered heaven with their tears:
Did he smile his work to see?
Did he who made the lamb make thee?
I'm telling him how many digits his number has. For example suppose you had 2^9 and you wanted to convert that to base 8. for whatever reason. You need to find log2 (8) and that will be 3. Then your result will be 8^(9/3). or 8^3. So 8^3 = 2 ^9. We did a similar process here. Eitherway you want to do it, the answer to rand's question is 6002 digits long.
I can explain if needed. Once you know that 2^3 = 8. This means that every time you multiply by 8 it's the same a multiplying by 2-- 3 times. So if a number was 8^2 and you were like what is that in base 2? Well multiplying by 8 once. would be the same as multiplying by 2--- 3 times. So doing it twice, would be 6 times. You have to multiplying 2-- 3 times every time you multiplying by 8. So 8^ 2 = 2^6.
8^3= 2^9.
And 2^19937 = roughly 10^6001. This implies 6002 digits.
Last edited by Lebanese Dragon; 12-29-2012 at 12:00 AM.
I'm pretty sure that he wanted a quick solution which one can enter into a calculator or Excel and which only yields the number of digits. Your method is only usable if you have a program which outputs numbers in scientific notation - and then you still have to parse the result once again manually.
Thus you use the logarithm to the base of what number system you want.
When the stars threw down their spears
And watered heaven with their tears:
Did he smile his work to see?
Did he who made the lamb make thee?
this is twisted, PERIOD![]()
"One day, we shall die. All the other days, we shall live."
It can be used with any calculator that has the log function. If you want it in program form (to solve for many such problems) there are better methods.Your method is only usable if you have a program which outputs numbers in scientific notation
Good grief, why I am I talking to you again?
When the stars threw down their spears
And watered heaven with their tears:
Did he smile his work to see?
Did he who made the lamb make thee?
Why are you so emotoinal as to which method is more useful? But mine is betterGood grief, why I am I talking to you again?![]()
For some reason I was hoping this was going to be an airplane-on-the-treadmill thread rehash.
6002 thanks. That's certainly a lot.
The reason is that on a game I play people (sore losers) keep complaining that the RNG isn't truly random. Apparently it is essentially completely random to a period of 2^19937 dice rolls. I think that's clearly sufficiently random to be declared truly random.
Depends on the distribution.
Anecdote #1: When I played Everquest 2 I stumbled upon the fact that someone responsible for random number generator didn't know what he was doing. To clarify: The actual random floating point numbers were probably fine - it was the calculation into Integers where it went wrong.
The guy responsible probably did the same error in thinking that I once did: So you have a RNG which outputs floating point numbers in the range [0,1) which means that the minimum will be zero and the maximum will be 0.999... (no, not to infinity!).
Thus, in order to get a number between 0 and 6 I simply did
The problem with this code: Both 1 and 6 only get half their weight in this distribution - you get a zero if the result is between 0 and 0.49. You get a 1 if the result is between 0.5 and 1.49... you get a 6 if the result is between 5.5 and 5.99.Code:Math.round(Math.Random()*6)
Same thing happened there. First and last numbers only got half their weight in this game.
Anecdote #2: Someone got the clever idea of "improving" the randomness by getting the RNG to spit out two random numbers and multiplying them. Two random numbers are better than one, right?
Only problem: Everyone should know that rolling two six-sided dice yields a 7 more often than a 2 or a 12. Same thing happens here.
http://mathworld.wolfram.com/UniformSumDistribution.html
When the stars threw down their spears
And watered heaven with their tears:
Did he smile his work to see?
Did he who made the lamb make thee?
Diablo II also has the n-1 bug. Not sure if they ever fixed it. Sure the stats are random, but they screwed up something where many stats never reached their absolute max.
edit: fixed in 1.08, when they launched the expansion. figures.
"In a field where an overlooked bug could cost millions, you want people who will speak their minds, even if they’re sometimes obnoxious about it."