Resolved Auto seed random number

Discussion in 'iOS Programming' started by thedollarhunter, Mar 28, 2012.

  1. thedollarhunter, Mar 28, 2012
    Last edited: Apr 3, 2012

    thedollarhunter macrumors member

    Joined:
    May 9, 2011
    Location:
    UK
    #1
    I am trying out different ways of generating random numbers and want to use a seed derived from something like the position of the last touch or some other human influence.

    Any other random tricks or tips would be great.
     
  2. SilentPanda Moderator emeritus

    SilentPanda

    Joined:
    Oct 8, 2002
    Location:
    The Bamboo Forest
    #2
    Why not just use the staple of the current time in milliseconds?
     
  3. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    What about converting the float to a string, grabbing the last character, converting that to an int?
     
  4. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #4
  5. thedollarhunter thread starter macrumors member

    Joined:
    May 9, 2011
    Location:
    UK
    #5
    Perfect, just what I was looking for :D

    Thanks

    link to man page for anyone else looking to compare random() v arc4random()

     

Share This Page