instruction
stringlengths
71
71.9k
I have four loops to populate and compare two two-dimensional arrays then add the results to the first array before writing back to the active worksheet. Wondering if anyone has a cleaner alternate or more elegant method? It works as is but haven't tested it on large arrays yet! Function lastRow(x As Range, y As Work...
I'm new to competitive programming and C++ in general. I have solved the Kattis Animal Classification challenge. We are given two classification trees, each represented using nested parentheses. For example, ((3,(1,(5,2))),4) and (((5,1),(2,3)),4) represent the trees ╱╲ ╱╲ ╱╲ 4 ...
Learning React, I have created a basic App Component and Modal Component, the App Component renders 2 actions - hold and cancel, and a Modal based on the state modalVisible. I've kept the Modal Component light opting to pass the events back to the App Component (not sure if this is recommended), my reasoning is that th...
The problem is also known as GSS4. The exact detail can be seen here but I reached TLE. You are given a sequence A of N(N <= 100,000) positive integers. There sum will be less than \$10^{18}\$. On this sequence you have to apply M (M <= 100,000) operations: (A) For given x,y, for each elements between the x-th and...
This Activity has got a RecyclerView that is inflated with an ArrayList that is ca. 400 Elements. This is what an Element of the ArrayList looks like: chords.add(new Accordo(new int[]{ R.drawable.do_maggiore, R.drawable.do_maggiore_alt1, R.drawable.do_maggiore_alt2, R.drawable.do_maggiore_alt3, ...
I had this idea to exploit anonymous lambdas that are immediately executed that wrap around an allocation function to track those allocations in a statically created Stats object. This is the code I came up with after some time #define TW_INLINE __attribute__((always_inline)) #include <iostream> #include <cstdin...
I created a class called HomeService that extends the android.app.Service. I then declared and implemented a class called BackgroundService which extends Thread. In the run method of the class I call the member method run of Runnable which calls my sendRequest method which is responsible for the Volley string request. ...
Here's my attempt at porting the Lua codebase for my programming language to C++(11). This is just the first step, the tokenizer, and I wanted to remove all the bad performance / practices / code before passing to the next steps. I'm also still learning C++ as I go through this experience, so I wanted to get it reviewe...
This is a program that loads a dictionary into a hash-table, and spell checks a text file provided as a command-line argument. The dictionary is formatted as such (just alphabetically): python bar foo code review When the program is done I am provided with output that looks like : This is part of a problem set where...
I need to print (or store) all diagonals of a matrix. This includes the main diagonal ( { (i,i) | i = 1, 2, ... min(m,n) } ). Then all super and sub diagonals. For example: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 The diagonals should be (order doesn't matter): [ [1, 6, 11, 16], [2, 7, 12], [5, 10, ...
I wrote code in Python that takes a string s as input and determines the longest substring of s that’s in alphabetical order. In the case where there are two strings of the same length, code outputs the first one. I'm a beginner with 1.5 weeks of experience and wrote both versions myself. Which one is better, and why?...
I would like general ideas on improvement for this implementation of Minesweeper I wrote in C++. I am not really good in OOP yet, so I want ideas about how I can refactor the code by adding objects (or structs) without it getting too bulky. /*Minesweeper C++ Written by:-Teodor D.*/ #include<iostream> #include<time.h...
But it looks like it is getting to big. How can I break this up into smaller pieces? In general this seems messy and I'm trying to make it more readable. /******************************************************************************************************************(120) ** BVFave ** - renders favorites using unders...
This is a velocity, distance, and time calculator that I wrote not too long ago. How can I improve upon this code? import java.util.Scanner; import javax.swing.JOptionPane; //imports //--------------------------BEGIN PROGRAM--------------------------------------------------------// public class justForFun {public ...
I am writing a JavaScript application and would like to validate function arguments in many places. Most of these checks will be for correct argument types, or numeric values within specific ranges. Here is a simple function I came up with to check any number of preconditions: function requires(conditions) { for (...
I wrote this function to check if a given string is in alphabetic order. How can I improve? def alphacheck(x): '''This function checks if a given string is in Alphabetical order''' # Creating a variable to allow me to efficiently index a string of any length i = len(x) - 1 # Using a recursive formula a...
I have a folder that contains around 1000 text files, their sizes varies from few KBs up to 500 MB (Total size is around 60 GB). I have a text file that contains a 166k lines, each line contains a set of numbers (length up to 11), what I'm doing here is to go through each file in that folder and try to find a match bet...
With the comments on the same line as the code, it refers to. e.g NumBob = 0 s = 'sexbobombob' i = range(len(s)+1) #Generates a list from 0 to the length of s u = 0 # This would be the variable storing each value of the list for ans in i: # this allows me to extract each value of i if ans > 0: # Completely arbitrar...
One day I stumbled upon a question on Stack Overflow: How do I create an array in javascript whose index starts from 1. The top answer says that it's impossible. However, that answer was posted in 2010 and things changed since then. ECMAScript 6 introduced Proxy, which allows to intercept basic language operations like...
I'm trying to make an SMS Shortner for a kata at Codewars: Your task is to shorten the message to 160 characters, starting from end, by replacing spaces with camelCase, as much as necessary. I've tried with a while loop and although the logic is correct, it's taking too long to process my tests. How can I optmize thi...
Below is my code for an attempted solution to cracking the coding interview exercise 1.8 written in python 3.5. The problem statement is: Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column are set to 0. I looked at the hints for this problem so I do know that my solution is n...
I am working through the book Algorithms in a Nutshell by George T. Heineman and trying to translate the pseudocodes into Rust. Here is a naive convex hull algorithm: use std::cmp::Ordering::Equal; use std::cmp::Ordering; use std::ops::{Add, Sub, Mul}; use std::collections::BTreeSet; #[derive(Debug, Copy, Clone)] pu...
This script documents every website visited and writes the text content of each webpage to its own individual file. It seems to work as intended. Is there anything I could do to improve it? #!/bin/bash ##################### ##### Functions ##### ##################### chrome() { osascript -e \ 'tell applicat...
I end up writing a lot of the same code when I query a database I thought I would try to encapsulate that all in a class that could be used by any provider that implemented IDbConnection. i'm not looking to do much, return a DataTable when I want a result set, things like that. Here is my first attempt. I've tested tha...
Is this a proper MVVM implementation? I copied it off a sample but the source would not open so I have to put stuff in spots? Should I call in different files? My first MVVM and have trouble with the concept. XAML <Window x:Class="MVVM01.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/present...
There are a lot of numerical properties to be invoked many times with an expensive calculation. Let’s say for the sake of example, they expose a Factorial: public class Analysis { public double n10 => F(10); public double n100 => F(100); double F(int n) => n <= 1 ? 1 : n * F(n-1); } I was looking ...
Challenge Determine the largest contiguous sum of integers in a list. Specifications The first argument is a path to a file. The file contains multiple lines. Each line is a test case represented by a comma separated list of integers. For each test case, find and print the largest contiguous sub-array sum. Sample Inp...
I'm new to C# and am trying to write a program that randomly generates complete Sudoku grid of variable size. I'm able to generate a 25x25 grid in usually less than 10 seconds but I haven't been able to make a 36x36. This is the method I thought of to create a grid: Instantiate structure classes: cells, rows, columns,...
I found this question on Hackerrank in dynamic programming: Define a modified Fibonacci sequence as: $$t_{n+2} = t_n + t_{n+1}^2$$ Given three integers, \$t_1\$, \$t_2\$, and \$n\$, compute and print term \$t_n\$of a modified Fibonacci sequence. Could this efficiency be improved? t1,t2,n = map(int, raw_input().s...
I wrote simple code to spell the number below 1,000,000,000. It works perfectly as per my intention. However, I do think my code is a little bit messy since I only able to imagine of using decision statements in my function/method. I'm still learning in writing Python function/method code. I will be glad if anyone here...
I have an array that contains n arrays and each of these arrays contain a different number of string elements. Each string contains a key word like evar#, event# or prop# (where # is a number). This is my goal: return all the key words from a string that is different with at least one of the other arrays return the ke...
Let's say I have a data collection, like a list, containing a set of objects with particular properties. Let's go with animals: [ cow, sheep, orangutan ] An animal has a property animal_data that contains taxonomic information, like kingdom, class, family and species. This establishes a hierarchy which says that each...
So my code here takes some parameters and then creates an SQLesque type of string (JQL). function makeJQL(status, project, priority, description, summary){ var arr = new Array(); // Could put a null check here if all parametres are undefined if(status.length > 0){ jql = "status="+'"'+status...
To check if a given point is inside a polygon or not is a very useful piece of code. Here is my implementation in JavaScript of an algorithm counting the number of times a ray crosses the perimeter of the polygon, and subsequently checking the parity. I have included an initial test doing a fast comparison with the rec...
I mean, that code should be written more clearly. Can you help me, have you yet one idea ? I Need to assign the value list_new to variable depending on the list value. The list value is not constant and list_new it's also not constant and depends on the list value. Wenn I have for example [1,1,1] then I have new list w...
Minimum working example below. The Matlab filter function filters the input data x using a rational transfer function defined by the numerator and denominator coefficients b and a and initial conditions z. My C++ version of the code is way slower than the Matlab one. My signal x is a huge valarray, a and b are three el...
I am reading some HTML files and returning them upon request, but when they go through my codes I need to filter out some stuff from these HTMLs, everything is working fine and I'm using about 20 or more str_replace and preg_replace to do that which works pretty fine. Until I used this $responseBody = preg_replace('/<s...
I have created a class which handles (what i call) idle chores. These chores need to be executed every x seconds (x is random every time but within a certain range defined in the settings) With this code review I'm hoping to find inefficiencies in the code, I need to optimise this because the performance is somewhat la...
I have a function that returns true or false depending upon whether there are any weekend days left in the month. Is there a better/cleaner way that I can write this? function checkWeekendsLeft(month, year) { var iDaysInMonth = new Date(year, month, 0).getDate(); var iCurDayInMonth = new Date().getDate(); var ...
I'm trying to make my script cross-Python (Python 2 and 3 compatible), and to solve an import problem I did this: __init__.py file import sys if (sys.version_info[0] < 3): from core import translate else: from .core import translate Is it the good way to do it?
I have a piece of code that works but, as I start learning OCaml, I am not confortable with the "functionnal style" to write code. The following code create two threads. One for a tcp server that accepts one client and sends him the "test" string. In the other thread, there is a client that reads in a socket after 2 se...
For my computer science class, I was required to write a lexical analysis program that would perform several functions on a std::string. The assignment required a function for each of the following: count number of a certain substring count number of words excluding numbers count number of unique words (excludes repea...
Continuing the Algorithm in a Nutshell series, here is the code: trait MaxElem<T> { fn max_elem<'a>(&'a self) -> &'a T; } impl<T> MaxElem<T> for Vec<T> where T: PartialOrd { fn max_elem<'a>(&'a self) -> &'a T { max_elem_helper(self, 0, self.len()) } } fn max_elem_helper<'a, T>(vec: &'a Vec<T>, le...
I'm working on an assignment which entails creating communicators following the diagonals of an n x n process grid. I'm interested to get feedback regarding the correctness of the solution I developed as well as feedback regarding the efficiency of the solution. #include <stdlib.h> #include <stdio.h> #include <math.h> ...
I would like some help with a review of a program that I wrote to identify the longest continuous sub-string that is in alphabetical order within a string. This is a JavaScript adaptation of an exercise originally written in Python. I am new to JavaScript. I would like any help identifying ways that this program cou...
Before you read ahead: ES6 may not be used. Consider a web-page showing a report of some data that is structured as follows: <button id='sort-by-category'>Category</button> <button id='sort-by-timestamp'>Timestamp</button> <section id='report-body'> <section class='report-section' data-category-name='fruit' data-it...
In reviewing an older project of mine, I noticed that in a particular class definition I'm doing this: var defaultOptions = { ... object of default options ... } var SDKClient = function(options) { var self = this ... _.defaults(self, options, defaultOptions) Object.defineProperty(self, 'clientId', ...
Adopted some suggestions from the answer of my previous post. Here is the code: trait MaxElem<T> { fn max_elem<'a>(&'a self) -> &'a T; } impl<T> MaxElem<T> for [T] where T: Ord { fn max_elem<'a>(&'a self) -> &'a T { max_elem_helper(self, 0, self.len()) } } fn max_elem_helper<'a, T>(array: &'a [T]...
I am currently rewriting a todo app from java to clojure. This is my first "real" clojure project so I'm not sure that what I write is idiomatic clojure code. I have just finished rewriting the domain module and I'd like to know how can I improve on it to have something which is idiomatic. I had some simple classes in ...
I had some great feedback on my code previously here and I was hoping that I could get some further help with writing a column of the array to the worksheet. I have an example here where I write one column of my array to the worksheet with a loop, but I'm wondering if there wouldn't be a more efficient way to do this: ...
I've implemented the coin change algorithm using Dynamic Programming and Greedy Algorithm w/ backtracking. The description is as follows: Given an amount of change (n) list all of the possibilities of coins that can be used to satisfy the amount of change It would be nice to have a code review to show me where I can ...
I am trying to solve the below problem from an online coding site: Fredo is pretty good at dealing large numbers. So, once his friend Zeus gave him an array of N numbers, followed by Q queries which he has to answer. In each query, he defines the type of the query and the number f for which Fredo has to answer. ...
I recently came across a need to display very large decimal numbers and realized that I could use a BigDecimal class. After some tinkering I decided to leverage the BigInteger class to do the heavy lifting. using System; using System.Numerics; using System.Text; namespace Numerics { public class BigDecimal : ICom...
This is an updated version of the script Fahrenheit / Celsius temperature converter. I have changed the script to be non-interactive, using positional parameters instead of asking for user input once the script is running. In my testing of the script, everything seems to work as it should. But I am quite new to using p...
We have a dynamically created map with two dimensional coordinates. There's an object in this map on a random position and I need to validate the four adjacent fields. However, I need to leave out the corners since they are not relevant for the validation! This is an illustration of what needs to be validated (the gree...
I am converting a non ARC projecs to ARC. I just found that after login in my old app, the data is stored in app delegate objects, like Home_DataArray, various flags and some other objects. I am bit confused at it, because my app delegate is looking like constant class and BoolDidFinishLaunch looks like parent of vario...
Any comments? I tried to make my code modular and testable. I tried to make use of dependency injection without using any frameworks. All the classes are stateless, immutable and thread-safe (I think). I also tried to code to interfaces, not implementations. Utils package biz.tugay.sakila.core.utils; import javax.pers...
We are being needlessly curtailed by the standard-supplied function containers, a lot more flexibility is possible. Try any_function, which can contain an arbitrary functor without having to specify it's signature. namespace { template <typename> struct signature { }; // template <typename> struct class_ref; // temp...
I have built a tiny script to send out push notifications. I would be glad to receive general suggestions / feedback. My main problem is that the only security offered is coming from the OS filesystem settings (making the config file not readable to other users) and I would be very happy to improve my code and make it ...
I have implemented three ways of Singleton idiom in Java, and now I want to write some test code to see there performance. Here is my code: public static void main(String...args) { long startTime, endTime; int MAX_ITE = Integer.MAX_VALUE; // Eagerly initialized static instance guarantees thread safety. ...
I have a list of units (as in entities in a game): workers = [engineer1, engineer2, scientist1, scientist2] These workers have a couple of properties I want to group them by: city and specialization. This grouping is nested, first we group by specializations and then by cities. Then we throw the list of workers that m...
I need make validation of Multipart file in form class. I wrote custom annotation for form class which validate Multipart file. This code works great, but I don`t know if this is a good approach. This code validates the Multipart file and shows a message on page if validation is invalid using jsp tag (form:errors cssCl...
I am trying to learn web scraping in Python using Beautiful Soup and requests. My program goes to the book page on Project Gutenberg with the given book number (Example). It then finds the link for the given format (text in this case) and then writes the contents of the book to a file on the hard disk. How and what can...
I'm repeatedly faced with writing proxy classes for various purposes, recently lazy evaluation and IPC. This usually means having a single method pattern, which just forwards the call. I'm having a hard time to do this efficiently and readable. Let's consider an example of a (trimmed down) lazy evaluation proxy: class...
So this is my first time implementing the MVP pattern in Android. As I understand the presenter should not contain any Android specific code. I am using TextInputLayout and I want to validate my text fields and show an error message using TextinputLayout.setError(""). Now the edittext validation logic is implemented i...
I'm iterating this JSON using a for loop: var movieObj = { "cat": { "moveName": "Breath", "rating": [4, 5, 4, 3] }, "cat1": { "moveName": "shallow", "rating": [5, 5, 5, 5, 4] } } Is there any way to improve this code? var sum; Array.prototype.getSum = function (ele) { ...
The Needleman–Wunsch algorithm is an algorithm used in bioinformatics to align protein or nucleotide sequences. Here is an implementation in Rust: #[derive(Debug, Copy, Clone, Eq, PartialEq)] pub enum Direction { Match, // go diagonally, left and up Left, Up, Undefined, } #[derive(Debug, Copy, Clone, ...
So the task was to first create a custom TCP protocol (namely ebl0) with certain parameters in its header and a number of methods to use with it (e.g. Login, Create, Join etc.). I'm not listing it here because it was relatively easy. The next step was building a server using this protocol that complies to the following...
I would like to make a Matrix class. Can any of you help me about this class? There are two ways: #include <iostream> class Matrix { private: double** array; int row, column; public: Matrix(int m, int n) { this->row=m; this->column=n; this->array = new double*[m]; for (in...
As you can see I have been using multiple conditions such as if, elseif, else, but it takes too much time to complete the process. How can I improve the speed of the script? Import-Module ActiveDirectory Import-Module MSOnline $password = ConvertTo-SecureString 'PASSWORD' -AsPlainText -Force $LiveCred = New-Object Sys...
Starting with the fact that creating the classic database handler in Android is really annoying and it usually takes a lot of time since you have to create one handler for each object, I thought at creating a generic one that could avoid this long work. I'm posting this code for many reasons, the main one being that I ...
I have an IPublisherFactory which publishes instances of, IPublishers. I'm feeding it a bunch of overloaded methods from this gigantic class, that I'm basically using for organization of the implementations. My concern is that, while it's nice to have the intellisense provided implementations on the client side, maint...
I've taken over a code base that is still very much in it's infancy, and stumbled across this class. I'm just wondering if it's actually worth it to have a SingletonProvider, and making use of Lazy<T> if it's just going to return the value straight away? public static class SingletonProvider { private static readon...
Below is a script to distribute jobs amongst workers while trying to maintain an even distribution of work and considering that not every worker can do every task. The solution I used is to find every possible legal combination of work distributions and pick the distribution with the least variance in workload between...
What do you think guys? module.exports = CDoublyLinkedList = function CDoublyLinkedList() { this._size = 0; this.first = undefined; this.last = undefined; } CDoublyLinkedList.prototype.iterator = function(data) { return new this.CIterator(this); } CDoublyLinkedList.prototype.size = function(data) { ...
For a specific usage I made a very simple template engine in Python, to display value. The code: import re class Template(object): """A simple template engine support only the substitute of variable""" def __init__( self, delimiter_start='[', delimiter_end=']', identifier=r'^[^\d\W]\w*$...
Lets we have a string Seq of size N and contain z alphabet { A,B,C….}. I have to perform a function that calculates number of occurrence of letter i which is separated with l letters (gap) form the letter j: Example: I=A, j=T and gap=10 That have to find the number of occurrence of AT,A-T,A--T,A---T,A----T,,,A---------...
I need to compress some text, I'm wondering if my program could be made more efficient. The only things I could think of would be the 'import re' and turning the filename input and read part as a function. import re from ast import literal_eval ################## Compression ##################### def comp(): whil...
My Script tries to find a password, using a brute force approach. The password is then tried using a GET call to a website. I'm not happy with the way the script looks, particularly the number of variables I have had to use for such a small validation. import mechanize import itertools import string br = mechanize.B...
I have created a registration form using jQuery. I am validating username and password using an AJAX request. The "submit" button is originally disabled and is only enabled when all three fields of username, email and password are filled and validated. How and what can I improve in this code? $(document).ready(function...
I searched but failed to find a canonical pattern for ES6 promise-based queue. In fact all I am making is a step-wise FIFO buffer to ensure that messages don't collide so a very simple queue structure: like a message, sausage machine... All it does is create a chain of promises, that resolve, at a fixed interval, to t...
I'm trying to find a simple, clean and fast way to implement an XML config file in C# without any 3rd party tools. It also should replace this restricted System.Configuration.ConfigurationManager. using System; using System.IO; [Serializable] public class MyConfigFile { // Static Members public static readonly...
void moveCircle(float dt, int radius) { //so center of screen will be rotation point setPosition(400+cos(_angle)*radius, 400 - sin(_angle)*radius); _angle += (2*pi)*dt; if (_angle >= (2 * pi)) { _angle -= (2 * pi); } this->rotate(-2*dt*180); } sf::Vector2f r...
I want to output only the roles that contain the same group as the user. // User can be part of many groups const user = { groups: ["group2"] }; // Roles can have many groups // What you see here is the output or 2 different data source // Thats why we have group duplication inside different role const roles = [{ ...
Recently I was thinking about the keyless entry on my car and how simple it has to be, so I wrote a C# programme to validate a StreamingPin, that is, a pin that is entered character-by-character, and resets as soon as an invalid character is input. If the correct sequence of characters is entered, then the pin is valid...
Here is the code: pub fn insertion_sort<T>(vec: &mut Vec<T>) where T: Ord + Copy { fn insert<U>(vec: &mut Vec<U>, pos: usize, value: U) where U: Ord + Copy { assert!(pos > 0); let mut pos: usize = pos - 1; loop { let value_at_pos = vec[pos]; if value_at_pos <= value ...
Description: Given the Knapsack capacity and the weight and value of some items, find a way to maximize the value in the given Knapsack. Code: /* Name of the class has to be "Main" only if the class is public. */ class Main { public static float KnapSack(float capacity, PriorityQueue<Pair> queue) { floa...
I'm extracting the first letter (not symbol) of a string using Unicode characters, with French words/sentences in mind. I have implemented it like this: def lettrine(text): first = next((c for c in text if c.isalpha()), "") return first assert lettrine(u":-)") == u"" assert lettrine(u"Éléphant") == u"É" assert...
I am trying to build a small search function where I can search through some JavaScript objects even if there are arrays in it. I got it working but I would like to ask if someone can find a better approach than the one I made. Also, I assume I have some cases I did not think of. My current search function looks as fol...
I'm creating my own general purpose library for personal use in C++ and it needs a string class that fits in with the rest of the library. Currently, it only has a few basic features, but because strings are a pretty important thing, I want my class to be very optimized. I don't want to be writing a bunch of methods fo...
Here is the new & improved Rubberduck 2.x entry point class, based on MZ-Tools 8.0's Connect.VBA implementation of the IDTExtensibility2 COM interface, graciously shared to the Rubberduck team by Mr. MZ-Tools himself, Carlos Quintero. The modifications made are not yet merged into the project's main repository at the t...
This is kind of follow up of this question on stack overflow... I wrote the following to utilize memoization for functions that take a single parameter and return a value: #include <iostream> #include <map> using namespace std; template <class T, class R, R (*Func)(T)> R memoized(T in) { static std::map<T,R> memo;...
I have a User model, a user has_many leave_requests, in the user model I have the following code to find the last 5 leave requests: def last_five_leave_requests leave_requests.order(:updated_at).limit(5).reverse end I kind of feel this code should live in the LeaveRequest model, what is the Rails way here to s...
I am using the following code in a Node.js / React project. It works fine but it looks like it could be consolidated a little more using a OO pattern. import projectsData from '../data/index.js'; function Project(project) { this.name = project.name; this.order = project.order; this.title = project.title; this...
I needed a function that would: Decode, and return, the first character in an UTF8 encoded strings Return the length of encoding with the special case that lenght of '\0' must be 0 Perfomance are important I had no special requirement on what to do with invalid sequences so I opted for the following behaviour: The f...
This is an algorithm for finding the closest pair of points on a 2d plane by dividing the problem by half recursively, as illustrated here: use point::Point; type PairDistance = (Point, Point, f64); // Divide and conquer approach for finding the closest pair of points // See https://i.stack.imgur.com/O3Drf.png pub...
There is a huge documentation about using and generating hashcodes for objects that will go into a dictionary, really few more if you try to look about hashcode of a dictionary. No, the default Dotnet dictionary doesn't override the Object.GetHashCode() method, so two different dictionary with same keys and same values...
I wrote this a long time ago. I came back to it and decided to clean it up a little. It uses the preprocessor and C99 anon structs to make a flexible python-like API for calling its functions. colorprint.c #include <stdio.h> #include <string.h> #include "colorprint.h" static const char *numch = "0123456789"; static...
Earlier today I wrote a question (Validating a StreamingPin) and I thought it was a good idea (apparently I was the only one who thought so, but whatever), so I proceeded further with it and developed a version of this programme in F#, with the suggestions from the original question implemented as well. I'm going to be...
I've a function to generate random characters from a set of alphabets. This function would be called multiple times and thus I'm trying to make it use same set of variables, i.e. have same seed so that strings don't repeat as long as possible. #include <iostream> #include <random> #include <string> std::string generat...