Skip to content

Instantly share code, notes, and snippets.

@isvaldo
Created April 13, 2015 01:44

Revisions

  1. isvaldo created this gist Apr 13, 2015.
    16 changes: 16 additions & 0 deletions randstr.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # -*- coding: utf-8 -*-
    import random

    def rd_string(length):
    """
    Criando Strings aleatórias usando casting
    """
    str_rd = ""
    while(len(str_rd)<=length):
    str_rd += '%c' % random.randint(97,122)
    return str_rd


    # Testing
    for n in range(0,100):
    print rd_string(n