|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming | |
Quick Delphi help V.2
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |||||||||||||
|
Audiophile
|
New question.
__________________![]() Use a repeat until loop to generate a random number in the range 1 to 1000, that is not exactly divisible by 3 and store the value in the Tag property of an edit box called edtExample So would this be right? (I don't really understand the question myself. Repeat edtExample.Tag := Random(999) + 1 ; Until edtExample.Tag Mod 3 = 0 ;
Last edited by Mebby : 02-21-07 at 12:15 PM. |
|||||||||||||
|
|
|
|
#2 (permalink) | ||||||||||||
|
Programmer
|
make an array with 3,6,9,12 and 15 in it, then use the RandomFrom function
http://delphi.about.com/library/rtl/blrtlRandomFrom.htm -------------------- var Numbers : array of integer; useThisOne : integer; SetLength(Numbers,5); Numbers[0] := 3; Numbers[1] := 6; Numbers[2] := 9; Numbers[3] := 12; Numbers[4] := 15; Randomize; useThisOne := RandomFrom(Numbers);
__________________
"If there is a god, I hope he has a good excuse" Woody Allen
Last edited by stupid : 02-15-07 at 08:05 PM. |
||||||||||||
|
|
|
|
|
#3 (permalink) | |||||||||||||
|
Audiophile
|
I ended up useing a case statment but that works to I guess.
__________________![]()
|
|||||||||||||
|
|
|
|
#4 (permalink) | |||||||||||||
|
Audiophile
|
Any suggestion on this one?
__________________
|
|||||||||||||
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|