Sample ClassGet Random Number Method
This returns a random number
Definition
Namespace: XMLCommentsExamples
Assembly: XMLCommentsExamples (in XMLCommentsExamples.dll) Version: 2025.4.26.0
A random number using SampleNumber as the seed.
Assembly: XMLCommentsExamples (in XMLCommentsExamples.dll) Version: 2025.4.26.0
C#
public int GetRandomNumber()VB
Public Function GetRandomNumber As IntegerC++
public:
int GetRandomNumber()F#
member GetRandomNumber : unit -> int Return Value
Int32A random number using SampleNumber as the seed.
Example
The following example demonstrates the use of this method.
C#
// Get a new random number
SampleClass sc = new SampleClass(10);
int random = sc.GetRandomNumber();
Console.WriteLine("Random value: {0}", random);VB
' Get a new random number
Dim sc As SampleClass = New SampleClass(10)
Dim random As Integer = sc.GetRandomNumber()
Console.WriteLine("Random value: {0}", random)C++
No code example is currently available or this language may not be supported.F#
No code example is currently available or this language may not be supported.