Random PBP


Closed Thread
Results 1 to 15 of 15

Thread: Random PBP

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default

    OK.....

    What is the best way to approach the need for the appearance of "random"?

    I have seen that there is a pattern and haven't figured out a way to circumvent it other than to make the sequence long to make it harder to see the pattern (LEDs)
    Mark

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    When you have a microprocessor that does the exact same thing every time you turn it on, it's very difficult to get truly "Random" numbers.

    I've seen people suggest amplifying the noise from a diode junction and reading it with the A/D. But I doubt the distribution of numbers would be very good because it ALWAYS returns to 0, and only infrequently makes it to 1023.
    So you would get many more low numbers than you would high ones.

    If you're interfacing with a Human, you can sort of get random numbers by having a timer free-running, and grab the timer value when the person presses a button. But if you need a lot of numbers really fast, that won't help either.

    I've never really seen a good method of getting truly random numbers with a PIC.
    <br>
    DT

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I've designed a few items that require some form of 'Random' (search 'Electronic Dice' for a primitive example). Most applications for 'true' Random are things like Games of chance, and usually require the User to Switch-On. Nobody keeps their finger on a Button for the same length of time, and if you're simply incrementing a variable (like a Timer as Darrel suggested) until the finger is off the Button, the chance of getting the same value twice is pretty minimal. Generating Random isn't difficult, generating 'equal weighting' for something like a Dice throw is a little more tricky!

    There is a place for 'Pseudo-Random' too. Especially in Science (and Mathematics), where there is a need to be able to accurately recreate an experiment (or a series of calculations) even if they contain an element of randomness.

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. Random Numbers
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 18th December 2008, 08:47
  3. Compiler differences between PBP 2.33 & 2.46
    By nikopolis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd May 2006, 19:01
  4. Newby- PBP wont compile for 18F (MPLAB)
    By jd76duke in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th December 2005, 23:30
  5. 6 random numbers limiting to 49 ?????
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 15th June 2005, 23:27

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts