Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,40 @@
|
|||
Procedure.s pickRandomElement(List source.s())
|
||||
Protected x = ListSize(source())
|
||||
|
||||
If x > 0
|
||||
SelectElement(source(), Random(x - 1)) ;element numbering is zero - based
|
||||
ProcedureReturn source()
|
||||
EndIf
|
||||
EndProcedure
|
||||
|
||||
;initialize list elements
|
||||
DataSection
|
||||
elements:
|
||||
Data.s "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"
|
||||
EndDataSection
|
||||
|
||||
#elementCount = 10
|
||||
NewList item.s()
|
||||
|
||||
Restore elements
|
||||
Define i
|
||||
For i = 1 To #elementCount
|
||||
AddElement(item())
|
||||
Read.s item()
|
||||
Next
|
||||
|
||||
If OpenConsole()
|
||||
Print("Source list: ")
|
||||
ForEach item()
|
||||
Print(item() + " ")
|
||||
Next
|
||||
PrintN(#CRLF$)
|
||||
|
||||
Print("Random picks from list: ")
|
||||
For i = 1 To 10
|
||||
Print(pickRandomElement(item()) + " ")
|
||||
Next
|
||||
|
||||
Print(#CRLF$ + #CRLF$ + "Press ENTER to exit"): Input()
|
||||
CloseConsole()
|
||||
EndIf
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
OpenConsole()
|
||||
|
||||
a$="One" +#TAB$+ "Two" +#TAB$+ "Three" +#TAB$+ "Four" +#TAB$+ "Five" +#TAB$+
|
||||
"Six" +#TAB$+ "Seven"+#TAB$+ "Eight" +#TAB$+ "Nine" +#TAB$+ "Ten" +#TAB$
|
||||
|
||||
Print("Source list: "+#TAB$+a$+#CRLF$+"Random list: "+#TAB$)
|
||||
|
||||
For i=1 To CountString(a$,#TAB$)
|
||||
Print(StringField(a$,Random(CountString(a$,#TAB$),1),#TAB$)+#TAB$)
|
||||
Next
|
||||
Input()
|
||||
Loading…
Add table
Add a link
Reference in a new issue