Results 1 to 2 of 2

Thread: Random Number

  1. #1

    Random Number

    Good evening,

    I have read around the forums and the manual about randomizing a number. Then RND command doesn't actually randomize a number, I have searched because couldn't find anything on "seeding" RND.

    How can I do this or point be somewhere in the manual I could learn this thanks.

    EDITED

    Apologies for this post as I obviously didn't look hard enough and fount the answer I was looking for: Randomize


    OneHitWonder

  2. #2
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    45
    Posts
    914
    Rep Power
    101

    Re: Random Number

    try this

    [code=thinbasic]Uses "console"

    Randomize Timer

    PrintL "random number: " + random1
    WaitKey


    Function TBMain() As Long

    MsgBox 0, "random number: " + random1
    End Function

    Function random1() As Long
    Local x As Long
    Static last As Long

    Do
    x = Rnd(1,100)
    Loop While x = last
    last = x

    Function = x
    End Function[/code]

    bye, frank
    you can't always get what you want, but if you try sometimes you might find, you get what you need

Similar Threads

  1. Random number
    By Michael Clease in forum thinBasic General
    Replies: 10
    Last Post: 03-06-2008, 10:08

Posting Permissions

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