Beispiel #1
0
		/// <summary>Creates a new random <see cref="sbyte" />.</summary>
		public static sbyte NextSByte(this Random rand)
		{
			return (sbyte) rand.BufferOfSize(sizeof (sbyte))[0];
		}
Beispiel #2
0
		/// <summary>Creates a new random <see cref="ushort" />.</summary>
		public static ushort NextUInt16(this Random rand)
		{
			return BitConverter.ToUInt16(rand.BufferOfSize(sizeof (ushort)), 0);
		}
Beispiel #3
0
		/// <summary>Creates a new random <see cref="byte" />.</summary>
		public static byte NextByte(this Random rand)
		{
			return rand.BufferOfSize(sizeof (byte))[0];
		}
Beispiel #4
0
		/// <summary>Creates a new random <see cref="double" />.</summary>
		public static double NextDouble(this Random rand)
		{
			return BitConverter.ToDouble(rand.BufferOfSize(sizeof (double)), 0);
		}
Beispiel #5
0
		/// <summary>Creates a new random <see cref="float" />.</summary>
		public static float NextFloat(this Random rand)
		{
			return BitConverter.ToSingle(rand.BufferOfSize(sizeof (float)), 0);
		}
Beispiel #6
0
		/// <summary>Creates a new random <see cref="long" />.</summary>
		public static long NextInt64(this Random rand)
		{
			return BitConverter.ToInt64(rand.BufferOfSize(sizeof (long)), 0);
		}
Beispiel #7
0
		/// <summary>Creates a new random <see cref="int" />.</summary>
		public static int NextInt32(this Random rand)
		{
			return BitConverter.ToInt32(rand.BufferOfSize(sizeof (int)), 0);
		}