Random Numbers RRS feed

  • Question

  • User686816714 posted



    How do i generate random numbers with Razor syntax in WebMatrix?



    Saturday, December 24, 2011 4:47 AM


  • User-821857111 posted

    You can use the Random class. Razor is just a wrapper around C# (or VB) to denote where server-side code begins and ends. Here's an example:

        var r = new Random();
        var randomNumber = r.Next();
        var randomNumberLessThan1000 = r.Next(1000);
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 24, 2011 4:59 AM