Professional Web Applications Themes

GoTo Random Record script?? - FileMaker

Can someone help me come up with what should be an obvious filemaker script to go to a random record between 1 and the last one in my database (about 500?) I can't figure out how to use the "random" function to give me a random integer between 1 and 500. Its driving me nuts! Reply [email]jwitkincts.com[/email] appreciated!! Joe W....

  1. #1

    Default GoTo Random Record script??

    Can someone help me come up with what should be an obvious filemaker script
    to go to a random record between 1 and the last one in my database (about
    500?)

    I can't figure out how to use the "random" function to give me a random
    integer between 1 and 500. Its driving me nuts!

    Reply [email]jwitkincts.com[/email] appreciated!!

    Joe W.


    Joseph Witkin Guest

  2. #2

    Default Re: GoTo Random Record script??

    * Joseph Witkin <jwitkincts.com>:
    >
    > I can't figure out how to use the "random" function to give me a random
    > integer between 1 and 500. Its driving me nuts!
    Tha Random function returns a random value between 0 and 1. Before you
    start thinking that its 0 or 1 think about the number of possibilities
    in terms of decimal values between 0 and 1.

    Now in terms of finding a value to go to a record in your db I suppose
    you could use the middle function and pull a couple of numbers from the
    random result, however, I bet another one of the fine people in this
    group have a fabulous mathematical answer for you.

    lou
    Lou Lesko Guest

  3. #3

    Default Re: GoTo Random Record script??

    In article <9bLjb.24303$Z86.21276twister.socal.rr.com>, "Joseph Witkin"
    <jwitkincts.com> wrote:
    >Can someone help me come up with what should be an obvious filemaker script
    >to go to a random record between 1 and the last one in my database (about
    >500?)
    >
    >I can't figure out how to use the "random" function to give me a random
    >integer between 1 and 500. Its driving me nuts!
    >
    >Reply [email]jwitkincts.com[/email] appreciated!!
    >
    >Joe W.
    Round(500*random,0)

    --

    Greg Dember Guest

  4. #4

    Default Re: GoTo Random Record script??

    In article <slrnbov15f.2ft.louleskosdf.lonestar.org>, Lou Lesko
    <loulesko> wrote:
    > * Joseph Witkin <jwitkincts.com>:
    > >
    > > I can't figure out how to use the "random" function to give me a random
    > > integer between 1 and 500. Its driving me nuts!
    >
    > Tha Random function returns a random value between 0 and 1. Before you
    > start thinking that its 0 or 1 think about the number of possibilities
    > in terms of decimal values between 0 and 1.
    >
    > Now in terms of finding a value to go to a record in your db I suppose
    > you could use the middle function and pull a couple of numbers from the
    > random result, however, I bet another one of the fine people in this
    > group have a fabulous mathematical answer for you.
    >
    > lou
    Random
    will give you a "random" decimal number between 0 and 1.


    Which means that
    Random * 499
    will give you a "random" decimal number between 0 and 499.


    Therefore,
    (Random * 499) + 1
    will give you a "random" decimal number between 1 and 500.


    Then
    Int((Random * 499) + 1)
    will remove the decimal digits, leaving you with a "random" whole
    number between 1 and 500.



    One problem here: computer Random functions are never really random,
    but it depends what you're trying to do as to whether that's a real
    problem or not.







    Helpful Harry
    "Just trying to help whenever I can." :o)
    Helpful Harry Guest

  5. #5

    Default Re: GoTo Random Record script??

    Thank you all. The combination of your answers worked:

    round ((random*499)+1),0)

    Joe



    "Greg Dember " <gregdemREMOVEberdatabase.calm> wrote in message
    news:greg-1610032304320001ava17.drizzle.com...
    > In article <9bLjb.24303$Z86.21276twister.socal.rr.com>, "Joseph Witkin"
    > <jwitkincts.com> wrote:
    >
    > >Can someone help me come up with what should be an obvious filemaker
    script
    > >to go to a random record between 1 and the last one in my database (about
    > >500?)
    > >
    > >I can't figure out how to use the "random" function to give me a random
    > >integer between 1 and 500. Its driving me nuts!
    > >
    > >Reply [email]jwitkincts.com[/email] appreciated!!
    > >
    > >Joe W.
    >
    > Round(500*random,0)
    >
    > --
    >

    Joseph Witkin Guest

  6. #6

    Default Re: GoTo Random Record script??

    Helpful Harry <helpful_harrynom.de.plume.com> wrote:
    > In article <slrnbov15f.2ft.louleskosdf.lonestar.org>, Lou Lesko
    > <loulesko> wrote:
    >
    > > * Joseph Witkin <jwitkincts.com>:
    > > >
    > > > I can't figure out how to use the "random" function to give me a random
    > > > integer between 1 and 500. Its driving me nuts!
    > >
    > > Tha Random function returns a random value between 0 and 1. Before you
    > > start thinking that its 0 or 1 think about the number of possibilities
    > > in terms of decimal values between 0 and 1.
    > >
    > > Now in terms of finding a value to go to a record in your db I suppose
    > > you could use the middle function and pull a couple of numbers from the
    > > random result, however, I bet another one of the fine people in this
    > > group have a fabulous mathematical answer for you.
    > >
    > > lou
    >
    > Random
    > will give you a "random" decimal number between 0 and 1.
    >
    >
    > Which means that
    > Random * 499
    > will give you a "random" decimal number between 0 and 499.
    >
    >
    > Therefore,
    > (Random * 499) + 1
    > will give you a "random" decimal number between 1 and 500.
    >
    >
    > Then
    > Int((Random * 499) + 1)
    > will remove the decimal digits, leaving you with a "random" whole
    > number between 1 and 500.
    >
    >
    >
    > One problem here: computer Random functions are never really random,
    > but it depends what you're trying to do as to whether that's a real
    > problem or not.
    >
    > Helpful Harry
    > "Just trying to help whenever I can." :o)
    What about
    Int((Random * Status (CurrentRecordCount) - 1) + 1)

    --
    Henk B
    Henk B Guest

Similar Threads

  1. Flash Forms: Goto Next Record, No Reload
    By Starman9999 in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: August 1st, 08:22 PM
  2. Random CSS Script
    By World Synergy in forum Macromedia Contribute General Discussion
    Replies: 2
    Last Post: July 17th, 06:16 PM
  3. Choose a random record
    By J?J in forum Macromedia ColdFusion
    Replies: 0
    Last Post: March 27th, 07:55 PM
  4. How to solve this? Random record in dataset or AdRotator
    By Miguel Dias Moura in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: September 23rd, 12:59 AM
  5. Replies: 2
    Last Post: September 24th, 07:23 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139