| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 16574 | 2002-03-12 01:13:00 | Excell | Guest (0) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 38827 | 2002-03-12 01:13:00 | Using the Random number generator on Excel, how can you eliminate repeated numbers? Any help would be greatly appreciated. Thanx Mortz |
Guest (0) | ||
| 38828 | 2002-03-12 03:18:00 | In Excel, using the =RAND() formula generates a number between 0 and 1 that has 15 decimal places. What are you using it for? Where is your problem exactly? |
Guest (0) | ||
| 38829 | 2002-03-12 03:55:00 | Am I right in thinking that each time you run you get the same sequence of 'random' numbers? That is because it is a 'pseudo random deterministic sequence' genenator, not a 'random nuymber' generator. There is a reason for it. But there will be a way to avoid it. In BASIC, I think that there was a 'RANDOMISE' command. In mainframes, we usually had a variable in the () which we gave a different value each time (the outpuit of one of the TIME() functions was good). Look in the Help for somthing like randomise (or 'ize' --- whichever the US likes). |
Guest (0) | ||
| 38830 | 2002-03-12 04:24:00 | Thanks for that Graham,I'll look for randomise! I was just using it for an assignment @ Polytech, where we had to make our own random lotto numbers! Thanx again! Mortz |
Guest (0) | ||
| 38831 | 2002-03-12 05:04:00 | The function =randbetween(1,40) if placed in 6 cells will generate random numbers in the Lotto range each time the sheet is recalculated, but there can be duplicates. This function requires the Data Analysis AddIn to be installed. |
Guest (0) | ||
| 38832 | 2002-03-12 05:43:00 | Hi. Jeez it's a while since I did this, but I think this is exactly your answer - don't quote me if I'm wrong!!! Use the following formula: =RANDBETWEEN(x, xx) where x is your low number and xx is your high - the solutions shouldn't repeat. |
Guest (0) | ||
| 38833 | 2002-03-12 21:02:00 | Part f your problem is that for Lotto each time you draw a ball there is one less to choose from for the next draw so you need to test if your latest draw has already been tried. Here is a small Excell Macro that does a 4 ball Strike draw ------------------------ 'Draw 4 balls from 40 Private i, j, k As Integer Private balls(4) As Integer Sub strike() Randomize ' so that you get different series each time you run it For i = 1 To 4 balls(i) = 0 retry: j = Int(Rnd * 40 + 1) For ii = 1 To i If j = balls(ii) Then GoTo retry Next ii balls(i) = j Next i Debug.Print balls(1); balls(2); balls(3); balls(4) End Sub |
Guest (0) | ||
| 1 | |||||