Top Experts [learn more]Top 4-10

9743 K

2458 K

1525 K
4. tcmeyers
5. kbata
6. Martie
7. Hammerton
8. rrenfrow
9. bneeman
10. plegler
Welcome, Guest. Please login or register.
April 18, 2015, 06:10:13 AM

Login with username, password and session length
Search:     Advanced search
Welcome to the FileMaker Web Masters Exchange.  If you have any questions about how to use this forum, please watch the getting started movie at:
27871 Posts in 6165 Topics by 1525 Members
Latest Member: alkyred
* Home Help Search Calendar Login Register
|-+  FMTouch
| |-+  FMTouch - FileMaker Databases on the iPhone and iPod iTouch
| | |-+  Random number generator
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Random number generator  (Read 868 times)
FMTouch Enterprise
Offline Offline

Posts: 17

« on: April 15, 2010, 12:45:45 AM »

I need to generate a random number (rolling a die). The only method I can currently think would be to have a table holding 1000 1-6 results that I have pre-generated and just work through them. This would work but has the obvious disadvantage of not being random :-)

Any other suggestions?


Offline Offline

Posts: 10
Kudos: 150

« Reply #1 on: April 20, 2010, 06:02:36 AM »

Actually your idea of storing a bunch of random numbers and picking the next one in the sequence is entirely reasonable and is superior to using a Random() function provided by software.  If you located a good source of random numbers, e.g. created by a math or science department, and imported that as your sequence of 1 million numbers, then you'd be in good shape.

All random number generators in software use a mathematical formula to figure out the next random number.  They are all "pseudorandom" in that they will all repeat after a while and don't have the expected random distribution.  They improve upon this a bit by using a random "seed" to the calculation.  In other words they start at a different place in the sequence.  When available a seed is selected from some randomish hardware location such as the number of milliseconds on the system clock.

A description of a common pseudorandom number generator is here.

Implementing the math on that page to write your own pseudorandom generator requires the Mod() function which is not supported in FMTouch according to the July 26, 2009 documentation.

I recommend creating that table of random numbers.

Here is a page that will help you automatically generate a large quantity of random numbers from 1 to 6 using atmospheric noise.
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!