C# Random Equals(Object)

Description

Random Equals(Object) determines whether the specified object is equal to the current object.

Syntax

Random.Equals(Object) has the following syntax.


public virtual bool Equals(
  Object obj
)

Parameters

Random.Equals(Object) has the following parameters.

  • obj - The object to compare with the current object.

Returns

Random.Equals(Object) method returns true if the specified object is equal to the current object; otherwise, false.

Example

The following code shows how to use Random.Equals(Object) method.


/*  w  ww. j a v  a 2 s. c  om*/
using System;

public class RandomNumbers
{
   public static void Main()
   {
      Random rand1 = new Random();
      Random rand2 = new Random();

      Console.Write(rand1.Equals(rand2));
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version