MBS Plugin Documentation
Statistics - FAQ - Plugin Parts (All, Dependencies) - Class hierarchie
New in Version 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 9.0
The list of the themes, classes, controls, modules, global methods by category, global methods by name, screenshots, licenses and examples.
Platforms to show: All Mac Windows Linux Cross-Platform
FAQ.How to do a lottery in RB?
Feedback.
Answer: Try this function:
Example:
Feedback.
Answer: Try this function:
Example:
Sub Lotto(max as integer,count as integer,z() as integer)
// Lotto count numbers of max put into the array z beginning at index 0
dim n(0) as integer ' all the numbers
dim m as integer ' the highest field in the current array
dim i,a,b,d as integer ' working variables
'fill the array with the numbers
m=max-1
redim n(m)
for i=0 to m
n(i)=i+1
next
' unsort them by exchanging random ones
m=max*10
for i=1 to m
a=rnd*max
b=rnd*max
d=n(a)
n(a)=n(b)
n(b)=d
next
' get the first count to the dest array
m=count-1
redim z(m)
for i=0 to m
z(i)=n(i)
next
'sort the result
z.sort
End Sub
Sub Open()
// Test it
dim z(0) as integer ' the array of the numbers
lotto 49,6,z ' 6 of 49 in Germany
' and display them
staticText1.text=str(z(0))+chr(13)+str(z(1))+chr(13)+str(z(2))+chr(13)+str(z(3))+chr(13)+str(z(4))+chr(13)+str(z(5))+chr(13)
End Sub
Monkeybread Software Realbasic Plugins - Messdiener Nickenich