Shop OBEX P1 Docs P2 Docs Learn Events
Propeller newbie needs help with rr.random — Parallax Forums

Propeller newbie needs help with rr.random

blake_machoblake_macho Posts: 5
edited 2009-02-27 06:45 in Propeller 1
Hey guys,

I am playing with my first Propeller project and it's extremely fun. Only issue I've had so far (there will be many, many more I'm sure) is that I'm trying to get some random numbers going on, and failing.

I created this function (after some searching around here):

PUB RandRange(Minimum, Maximum)
  result := (rr.random // (Maximum - Minimum)) + Minimum



Any reason why this wouldn't work? Everything compiles fine, I just get the distinct impression I am not getting correct values back (since my servos are sittin' pretty). I'm passing in values like 130, 180. If this is the wrong implementation can you point me in the right direction? Thanks!

Comments

  • mctriviamctrivia Posts: 3,772
    edited 2009-02-27 06:45
    did you call rr.start ?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod $50CAN has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module.
Sign In or Register to comment.