Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Shifting Elements Forward in a List, and Random Numbers Generation
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here // a test to shift elements in a list List <float> myFloatList = new List<float> ( new float[] { 5.2f, 2.2f, 5.4f, 6.7f, } ); Random rndTmp = new Random(); for (int w=0; w<5; w++) { // generate a random float from a string of integers, converted back to float float tmpRandom = Convert.ToSingle(string.Format("{0}.{1}",rndTmp.Next(99), rndTmp.Next(99))); myFloatList.Add(tmpRandom); // at random float to the last element myFloatList.RemoveAt(0); // remove the first element Console.Write(string.Format("{0}th run:\t",w)); foreach (float x in myFloatList) { Console.Write(string.Format("{0}\t",x)); } Console.WriteLine(); } } } }
run
|
edit
|
history
|
help
0
Z_non_pow
test2
asdfgthyjukjyhtgrfed
іфи
Dependency Injection - with class
prime
circular linked list
Simplified login system
project euler 18
Enigme