Coder Social home page Coder Social logo

randomizer's Introduction

Randomizer

A Swift library to generate random elements like string, int, double, float, date, bool, name, city, state, salary. Pending elements address, phone, email, location, geopoint, lat/long, geohash, social id, url, uuid.

Use:

let str1      = Random.string(10)
let str2      = Random.string(10, caps: true)
let num1      = Random.int(10)
let num2      = Random.int(from: 1, to: 100)
let num3      = Random.double(9.99)
let num4      = Random.double(from: 0.0, to: 99.99)
let num5      = Random.float(9.99)
let num6      = Random.float(from: 0.0, to: 99.99)
let day1      = Random.date()
let day2      = Random.date(from: 1920)
let day3      = Random.date(from: Date.epoch)
let day4      = Random.date(from: Date.yearIni, to: Date.today)
let ok1       = Random.bool()
let ok2       = Random.bool(probability: 25) // 25% probability
let name      = Random.name()
let city      = Random.city()
let state     = Random.state(short: true)
let (city1, state1) = Random.cityState()
let address   = Random.address()
let phone1    = Random.phone()
let phone2    = Random.phone(state: "FL")
let phone3    = Random.phone(code: "305")
let salary1   = Random.salary()
let salary2   = Random.salary(from: 50000, to: 95000, dec: 2)
let email     = Random.email()
let color     = Random.color()

let listInt1  = RandomList(10).int(100)
let listInt2  = RandomList(10).int(from: 0, to: 100)
let listDbl1  = RandomList(10).double()
let listDbl2  = RandomList(10).double(from: 0.0, to: 99.9999, dec: 4)
let listFlt1  = RandomList(10).float()
let listFlt2  = RandomList(10).float(from: 0.0, to: 99.9999, dec: 4)
let listDay1  = RandomList(10).date()
let listDay2  = RandomList(10).date(from: 1920)
let listDay3  = RandomList(10).date(from: Date(1920,01,01))
let listDay4  = RandomList(10).date(from: Date.epoch)
let listDay5  = RandomList(10).date(from: Date.yearIni, to: Date.today)
let listBool  = RandomList(10).bool()
let listName  = RandomList(10).name()
let listCity  = RandomList(10).city()
let listState = RandomList(10).state()
let listColor = RandomList(10).color()

Enjoy!

randomizer's People

Contributors

kuyawa avatar

Watchers

Suhaib Abdulghani avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.