Message Board


Message Board > Programming > maths, combinations, probabilities

June 26, 2008, 13:39
DTM
Earthling!
821 posts

So I forgot all my maths.

OK. I have a string of length N, with each position having either a number 0-9 or a letter a-z or A-Z. That's about 62 possibilities.

e.g. gh7Uf83kY7G0k7
(N=14)

QUESTION 1) How many possible combinations are there?

Is it like 62^N or something?

QUESTION 2) Say, X amount of these strings were randomly generated. What's the probability that there are any duplicates?
____________
:o
#
June 26, 2008, 13:48
(. )( .)
top pussy
447 posts

1) 62 times N is correct.

2) every 62 times N ie 62 times N to one?

I don't remember propability maths either but that's my best guess.
____________
gay
#
June 27, 2008, 14:04
DTM
Earthling!
821 posts

my life depends on this you know

do you mean times? or to the power of... times wouldn't be a lot.

This is for some sort of media server thingy where I don't want people to be able to randomly guess a file name.
(as I can't be bothered to password protect the files...)

people will have a link like http://blahabhab.com/?myfile=sd3a8uas90fids
____________
:o
#
June 27, 2008, 15:20
Eckolin
Quite Whiskered
388 posts

Probability for no duplicates with N draws from M possibilities:

P(0,M) = 1
P(1,M) = (M/M) * P(0,M)
P(2,M) = (M-1)/M * P(1,M)
P(3,M) = (M-2)/M * P(2,M)
...
P(N,M) = (M-N-1)/M * P(N-1,M)

P(N,M) = (M!/(M-N)!)/(M^N)

You're looking for 1 - P(N,M).
____________
Maker of Games...
Wisdom is supreme; therefore get wisdom.
Need help with coding? I probably wrote something similar.
#
June 27, 2008, 16:52
Dennis
どこかにいる
2092 posts

Oh yeah that.

Wikipedia my friend.

Comb: (K = length string; N= 62)


62!/(len!*(62-len))

62! = 62*61*30*...*1
____________
Kwakkel
#
June 27, 2008, 20:11
DTM
Earthling!
821 posts

I think I'm going to have a nervous breakdown :-(

Thanks! :)
____________
:o
#
June 27, 2008, 20:29
Eckolin
Quite Whiskered
388 posts

Bottomline: with this number of possible combinations you won't have to worry about duplicates unless you plan to store billions.
____________
Maker of Games...
Wisdom is supreme; therefore get wisdom.
Need help with coding? I probably wrote something similar.
#
June 27, 2008, 23:36
DTM
Earthling!
821 posts

YAY! Something I understand :) Thankyou again.
____________
:o
#
June 30, 2008, 01:31
Dennis
どこかにいる
2092 posts

Work--; and DTM is happy :D
____________
Kwakkel
#
October 18, 2008, 20:55
PB
Defender of the faith
630 posts

Google is your friend (I supose anyway, since they know you so intimately): http://www.google.nl/search?hl=nl&q=62%21

Chances of duplicates: 1 in 3.14699733 * (10^85)

Oh crap this thread is old... :P
____________
#
October 18, 2008, 23:25
Eckolin
Quite Whiskered
388 posts

I don't know what you're calculating, but you may want to look at the article Birthday Attack for my understanding of the original problem. My friend Google yields about 4,41 × 10^12 for the expected number of additions before a collision takes place, confirming my earlier estimate.
____________
Maker of Games...
Wisdom is supreme; therefore get wisdom.
Need help with coding? I probably wrote something similar.
#
October 19, 2008, 01:33
PB
Defender of the faith
630 posts

I was trying to find a formula to get to pi up to one dicimal precicely and then times 10^85...

Please ignore me further, I'll be under the big rock around the corner if you need me...
____________
#
October 19, 2008, 01:39
DTM
Earthling!
821 posts

You're all a bunch of clever *beep*s :)

It was for vocaroo media IDs. So anyone (with a bit of hackery) can listen to any message if they can guess the string. But it's not really that terrible if they do ;)
____________
:o
#
October 19, 2008, 18:39
PB
Defender of the faith
630 posts

Actually I was quite much being a dumb *beep*, but that doesn't matter anymore, since I'm under a big rock now and noone sees me here...

Anyway, you all better listen to eckolin now...
____________
#
February 2, 2010, 00:59
DTM
Earthling!
821 posts

I have another dumb question.

Say a two way choice is given three times.

Now what is the probability that a randomly generated prediction would match the users' choice?

Is it correct to do 2^3 giving a 1/8 chance?
____________
:o
#
February 2, 2010, 19:11
Eckolin
Quite Whiskered
388 posts

Are all choices equally likely? In that case it is correct.
____________
Maker of Games...
Wisdom is supreme; therefore get wisdom.
Need help with coding? I probably wrote something similar.
#
February 2, 2010, 22:36
DTM
Earthling!
821 posts

I guess they are, unless there is some kind of psychology goin' on.

The Neutronium-Broadphase Corporation thanks you for your answer, Eckolin!
____________
:o
#
February 12, 2010, 22:32
OScoder
None
1338 posts
Quoting DTM:
You're all a bunch of clever *beep*s :)

It was for vocaroo media IDs. So anyone (with a bit of hackery) can listen to any message if they can guess the string. But it's not really that terrible if they do ;)


Alternatively, you could: http://www.google.co.uk/search … ite:vocaroo.com :-)
____________
om
#
February 14, 2010, 23:39
DTM
Earthling!
821 posts

Ha! Well, if people will post the links on the internet...

P.S. http://mentegraph.com
____________
:o
#
June 30, 2011, 14:22
Dennis
どこかにいる
2092 posts

Quoting DTM:
Ha! Well, if people will post the links on the internet...

P.S. http://mentegraph.com


That link is dead, DTM.
____________
Kwakkel
#
July 6, 2011, 18:55
DTM
Earthling!
821 posts

Here you go, Dennis:
http://xzist.org/mentegraph/
____________
:o
#
July 6, 2011, 21:35
PB
Defender of the faith
630 posts

They should track mouse movement for increased accuracy...
____________
#
July 18, 2011, 13:11
Dennis
どこかにいる
2092 posts

It's funny how it is being traced. I don't get it how it says it read it with 85% probability and not 50%

By the way, there are more psychological factors. if you chose a triangle first and next you get another choice to pick between circle and triangle you're more probable to pick the circle the second time.

It looks mind reading but it is not. It's maipulation.


another example:

1. Think of a color.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Color has been stored.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2. Think of a working tool
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Tool has been stored.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Now outputting...
...
.
.
.
.
...
.
.
.
.
...
.
.
.
.
OUTPUT COLOR = RED
OUTPUT TOOL = HAMMER
.
.
.
.
PREDICTION COMPLETED.
____________
Kwakkel
#
July 19, 2011, 14:34
DTM
Earthling!
821 posts

> I don't get it how it says it read it with 85% probability and not 50%

It's lying, you see.
____________
:o
#
July 19, 2011, 16:25
Dennis
どこかにいる
2092 posts

but did you have the red hammer? That is for 98% certain.

I cannot say the chance is 50% because the previous choice influences your next choice. It's not random.
____________
Kwakkel
#

Page 1 , 2


Message Board > Programming > maths, combinations, probabilities

Quick reply


You must log in or register to post.
Copyright © 2005 Booleansoup.com
Questions? Comments? Bug reports? Contact us!