Newbie needs help


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Jun 2008
    Posts
    16


    Did you find this post helpful? Yes | No

    Default

    That's what I've got going now...

    Randomizer:
    RANDOM rand
    high 3 : pause 10 'Blinks an LED once per random number generated
    low 3 : pause 10
    IF rand > 100 THEN Randomizer
    IF rand < 1 THEN Randomizer


    but the "random" numbers just seem to get larger and larger. After rand > 100 it just goes into a vicious blinking cycle, never to return.
    www.theLanguageBear.com - Multi-Lingual books for kids and adults of all skill levels.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by chien_fu View Post
    That's what I've got going now...
    Randomizer:
    RANDOM rand
    high 3 : pause 10 'Blinks an LED once per random number generated
    low 3 : pause 10
    IF rand > 100 THEN Randomizer
    IF rand < 1 THEN Randomizer
    but the "random" numbers just seem to get larger and larger. After rand > 100 it just goes into a vicious blinking cycle, never to return.
    What does your manual say about random, specifically the last sentence in the section about RANDOM?
    And what is the answer to 65535/655 ?
    Can you do anything at all with that?

  3. #3
    Join Date
    Jun 2008
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    What does your manual say about random, specifically the last sentence in the section about RANDOM?
    And what is the answer to 65535/655 ?
    Can you do anything at all with that?
    I see the thread paused for a bit, so I thought I'd twist my head around this and suggest setting rand to 0 before running the randomizer every time, otherwise it'll use the existing rand-value as seed and thus just grow?

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Or use a 16 timer value as a seed the first time, or use an external clock, or this, or that.
    It's been discussed here numerous times on how to get truly random numbers and best answer so far is to seed the randomizer with a truly random event such as a user input which, most likely, could never be exactly the same every time.

Similar Threads

  1. Newbie making an ignition timer
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 5th August 2012, 18:45
  2. Newbie HELP :(
    By TheOne in forum mel PIC BASIC
    Replies: 3
    Last Post: - 27th March 2009, 18:15
  3. Newbie: Temperature measurements
    By Budda in forum General
    Replies: 10
    Last Post: - 30th March 2007, 10:56
  4. PIC Newbie
    By azmax100 in forum Schematics
    Replies: 7
    Last Post: - 23rd February 2007, 05:52
  5. request for a newbie forum
    By nimonia in forum Forum Requests
    Replies: 1
    Last Post: - 20th May 2006, 10:01

Members who have read this thread : 0

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