You'll have to use the rand function, look here for some information about it ...
Edit:: A remark on the title of this thread: A computer will never be able to generate real random numbers :)
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
I never knew music files could generate random numbers :icon_eek:
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
> I never knew music files could generate random numbers :icon_eek:
> Lol :P, I thought he wanted to generate a random number for the filename of a music file ...
> Anyways: kelechi, could you please reformulate your question in a way we can understand it ?
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
Well, you may record the sound to a file. Then use some hashing algorithm ( like md5sum) to calculate the hash number of that file.
Each different type of sound will give you different files. And if two files are different, their md5sum hash will of course be different.
siddhant3s
Practically a Posting Shark
816 posts since Oct 2007
Reputation Points: 1,486
Solved Threads: 140
Ok so I want to create some code which can generate a random number from a
1. Music file
2. A microphone
PLEASE is their anyway i can do this
It's possible but you need non-trivial theory and lots of experiments. As usually results of these works were a very protected (sometimes patented or/and top secret) know-how(s)...
It's the other story why...
The key point is: what's (and why) a distribution of your home-made generated sequence? If you don't know the answer then it's not atrue random number generator...
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
What i mean is to take sound from my microphone and turn it into a number
A number based on what? Frequency? Decibels? Much more detail is needed.
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
>>does anyone know how i could do this
No, not I. But you could try this .
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
And if two files are different, their md5sum hash will of course be different.
not true. MD5 is broken.
in 2004, Wang et. al. demonstrated that forced MD5 collisions could be generated; in December 2008 the Chaos Communication Group forged an SSL certificate using forced MD5 collisions, in March 2009, Kilma published an algorithm that will force an MD5 collision using a single computer in less than one minute.
jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
>>not true. MD5 is broken.
This is true that MD5 has been broken. I heard this news long before.
I said he could use some hashing algorithm, not necessarily MD5. But the point in giving example as MD5 was that it is very famous.
siddhant3s
Practically a Posting Shark
816 posts since Oct 2007
Reputation Points: 1,486
Solved Threads: 140
> MD5 has been broken
>> OK, but it's just really difficult how to do it, a normal PC-user will never manage to break this algorithm, so if your MD5 is just used as a checksum it doesn't really matter whether it can be broken or not :) ...
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
>>not true. MD5 is broken.
This is true that MD5 has been broken. I heard this news long before.
I'm happy to hear you are so well-informed.
so now there's no reason for you to continue promoting MD5 as an algorithm that produces unique hash values, yes?OK, but it's just really difficult how to do it, a normal PC-user will never manage to break this algorithm
what a terribly fatal assumption! are you telling me a skript kiddie can't read a published algorithm and implement it on a $200 laptop?
"security through obscurity" is no security at all.
.
jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
so now there's no reason for you to continue promoting MD5 as an algorithm that produces unique hash values, yes?
And what about SHA1 ?
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
Yes. and No
Yes because it is really broken.
No because it is practically not broken.
I agree with Tux in this regard.
Comparing to the simplicity, the hashing solution will be more practical.
Else, do you have any good solution jephthah?
siddhant3s
Practically a Posting Shark
816 posts since Oct 2007
Reputation Points: 1,486
Solved Threads: 140
what a terribly fatal assumption! are you telling me a skript kiddie can't read a published algorithm and implement it on a $200 laptop?
"security through obscurity" is no security at all.
.
> If the hash is just used as a checksum I don't know anybody who would like to put his time and effort in this to (try to) break it :) ...
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
The OP problem was not specified. I want true random numbers - what did OP mean by that? There are lots of possible answers. May be SHA1 digest of anything is a good solution (of undefined problem;)), it's a question ...
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348