Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding features to PRNG

    I need to add the following features to a prng:
    - Number generator should have overloaded methods to allow random floats, doubles, integers ( Signed and unsigned )
    - Entire thing should be in a static class ( So methods can be accessed like myRand::GetRandULong() )
    -Also, it must support overloaded ranges ( Eg. random float from 0.038 to 6.428 )
    I have this:
    Code:
    #include <iostream>
    #include <cstdlib>
    #include <ctime>
    
    using namespace std;
    
    int main()
    {
        srand(time(0));
    
        for(int x = 1; x<2500;x++){
            cout << 1+(rand()%2000) << endl;
        }
    }

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,901
    Thanks
    46
    Thanked 202 Times in 201 Posts
    so..... What is your question?

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #3
    New to the CF scene
    Join Date
    Jul 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How do I do it?

  • #4
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,901
    Thanks
    46
    Thanked 202 Times in 201 Posts
    What part are you asking for help on? No one will just do it. What is or isn't working? Have you written the pseudo code for it (start there- then translate that into actual code)

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •