1

I have a thought, but am unsure how to execute it. I want to take a somewhat long usb cable and plug both ends into the same machine. Then I would like to send a signal from one end and time how long it would take to reach the other end. I think this should cause signal to arrive at different times and that would cause me to get random numbers.

Can someone suggest a language in which I could do this the quickest? I have zero experience in sending signals over usb and don't know where to start or how to start. Any help will be greatly appreciated.

I simply want to do this as a fun in home project, so I don't need anything official and just would like to see if this idea can work.

EDIT: What if I store the usb cable in liquid nitrogen or a substance just as cold in order to slow down the signal as much as possible (I have access to liquid nitrogen).

Quillion
  • 6,346
  • 11
  • 60
  • 97

2 Answers2

1

Sorry I can't comment (not enough rep), but the delay should always be the same through the wire. This might limit the true randomness of your numbers. Plus the acutal delay time in the wire might be shorter than even a CPU cycle.

If your operating system is Windows, you may run into this type of issue:

Why are .NET timers limited to 15 ms resolution?

Apparently the minimum time resolution on Windows is around 15ms.

EDIT: In response to your liquid nitrogen edit, according to these graphs, you may have more luck with heat! Interestingly enough...

Temperature vs Conductivity http://www.emeraldinsight.com/content_images/fig/1740240120008.png

Community
  • 1
  • 1
Elwood Hopkins
  • 151
  • 1
  • 9
  • I am using Linux, so I will have access to nanoseconds, and will have more freedom. But is there no way at all to use delay as random number generator? – Quillion Jul 01 '13 at 18:46
  • 1
    Difficult to say. Most random number generators take a seed value and then shoot the number around in a mathematical labyrinth... I believe if you could think of a way to use delay, it would be quite different from existing algorithms. – Elwood Hopkins Jul 01 '13 at 18:50
  • 1
    Thought about it some more, and it seems like what you're doing would be similar to reading data off of some arbitrary bus - which would be a good way to get random numbers. What data will you send over the wire? Also, the liquid nitrogen in your edit is an interesting idea - you sound like an ambitios person. Good luck! – Elwood Hopkins Jul 01 '13 at 19:08
  • 1
    Since it is the same machine, I would like to create two threads, one sends the data and records the time of being sent, and second one records data as soon as it receives something. Just have to find a way to program it since I have no experience in usb communication (especially on the same computer). I guess I will try both heat and cold to see what yields better results. – Quillion Jul 01 '13 at 19:26
  • 1
    Maybe try Python with PyUSB - I found python to be easy to learn. – Elwood Hopkins Jul 02 '13 at 10:39
0

I want to take a somewhat long usb cable and plug both ends into the same machine.

Won't work. A USB connection is always Host -> Device, a PC can only be Host. And the communication uses predictable 1 ms intervals - bad for randomness.

Some newer microcontrollers have both RNG and USB on chip, that way you can make a real USB RNG.

What if I store the usb cable in liquid nitrogen or a substance just as cold in order to slow down the signal

The signal would travel a tiny bit faster, as the resistance of the cable is lower.

Turbo J
  • 7,563
  • 1
  • 23
  • 43