/dpt/ - Daily Programming Thread

What are you working on, Cred Forums?

Previous thread:

Other urls found in this thread:

crypto.stackexchange.com/questions/1025/can-one-generalize-the-diffie-hellman-key-exchange-to-three-or-more-parties
tornadofx.io/
pastebin.com/QxikmuGm
golang.org/doc/faq#generics
success.outsystems.com/Evaluation/Getting_Started_With_OutSystems/05_Does_OutSystems_help_customers_build_applications/40_Expert_Services
github.com/puddly/android-otp-extractor
github.com/qdot/deldo
youtube.com/watch?v=FQRW0RM4V0k
stallman.org/articles/on-hacking.html
twitter.com/AnonBabble

java

web
assembly

pls no

Im currently trying to build open scene graph. or should I say I built it except like 4 or 5 plugins.

I made the project with cmake and all dependencies are provided and basically everything works. except I get those problems when I compile it.

I already fixed a bunch if other problems by compiling the dependencies in question myself. but there seems to be a deeper problem that it doesnt work out of the box as it should. anyone some ideas?

first for nim!

last for crystal

Second for nim. Currently porting my game engine from Rust.

If you used C you would have been first

but I did use C, in the long run at least, after compiling

Not if you include development time

>If you used C you would have been first
in highest bug count? Definitely
/samefag

I'm working on a java app. Why a java app in 2018 you may ask? Because our group of 7 people is too uncoordinated to be able to setup a database and a PHP server so we're just hardcoding the data in

...

My latest act of artistic genius, a la Fortran:

C Uses Newton's Method to find the square root

PROGRAM SQRT
REAL NUM
REAL NEWTON ! Not including this caused a type mismatch error.
REAL X
WRITE(UNIT=*,FMT=*) "Enter a number: "
READ(UNIT=*,FMT=*) NUM
X = NEWTON( NUM )
IF( MOD( X, 1.0 ) .LT. 0.01 ) THEN
WRITE(UNIT=*,FMT='(1X,I9)') INT( X )
ELSE
WRITE(UNIT=*,FMT='(1X,F13.9)') X
ENDIF
END

FUNCTION NEWTON( NUM )
REAL NUM
REAL NEWTON ! Guess
REAL DIV ! Relative reciprocal of guess
NEWTON = 1.0
50 DIV = NUM / NEWTON
NEWTON = (NEWTON + DIV) / 2
IF( ABS( NUM - (NEWTON * NEWTON) ) .GT. 0.001 ) THEN
GOTO 50
ENDIF
END

No.
C Uses Newtons Method to find the square root

PROGRAM SQRT
REAL NUM
REAL NEWTON ! Not including this caused a type mismatch error.
REAL X
WRITE(UNIT=*,FMT=*) "Enter a number: "
READ(UNIT=*,FMT=*) NUM
X = NEWTON( NUM )
IF( MOD( X, 1.0 ) .LT. 0.01 ) THEN
WRITE(UNIT=*,FMT='(1X,I9)') INT( X )
ELSE
WRITE(UNIT=*,FMT='(1X,F13.9)') X
ENDIF
END

FUNCTION NEWTON( NUM )
REAL NUM
REAL NEWTON ! Guess
REAL DIV ! Relative reciprocal of guess
NEWTON = 1.0
50 DIV = NUM / NEWTON
NEWTON = (NEWTON + DIV) / 2
IF( ABS( NUM - (NEWTON * NEWTON) ) .GT. 0.001 ) THEN
GOTO 50
ENDIF
END

...

C on suicide watch

Re-learn javascript
Learn NoSQL DB

>implying any amount of money can compensate for the hours of your life lost being a webmonkey

What do you guys think about round-robin DH using RSA private keys as the DH private exponent? If I use that system, I could also use the private key to verify identities, killing two birds with one stone.

>RoR
>Obj-C

Wrong.

Speak English, doc

Isn't that how it's done already? I did an implementation a while back but can't remember exact details

crypto.stackexchange.com/questions/1025/can-one-generalize-the-diffie-hellman-key-exchange-to-three-or-more-parties

Ah fuck you're right, SSL uses asymmetric keys.
I need to think before I post.

For one of my classes we're doing an engineering project and my group wants to make a mockup of the app. I got stuck with that part. How would i even go about learning this? I have four weeks and i took a java class. It doesn't have to do anything. I just want to make it look good and have some clickable buttons. And maybe a loading screen when the app opens up.

You could be a nonce and embed a webpage in the app, rendered with JavaFX.

Powerpoint. Not even joking.

Kotlin + TornadoFX
tornadofx.io/
- boilerplate-free (picrel)
- screencasts
- well-supported (Google!) language by the makers of the most used JVM IDE
/shill

>Visual Basic
Hahahahah fucking why

any questions?

does anyone here have a simple C/C++ example of libxml getting data out of xml document with the said document attached?
i only found tutorials (in jargon) that work on god knows what and in the end i have no idea what's going on

One of our clients has a Pajeet-made VB.NET project that we've been ordained by the gods of cruelty to rescue. It's been two years, and we're still working on it.
I fucking hate VB.

Nice job, Pig Fucker.

I know even less web development than i know java
I was thinking of uploading it to the play store so my class could download it. We have to present this thing so i wanted to ham it up

You have to do it for Android? That won't be bad, there are plenty of ways to mockup apps.

You Can Write FORTRAN in any Language

What exactly uses x86 still? How are these platforms still relevant? And do i need to care if i'm building for newer software/hardware?

That's how Microsoft does it after all.

"Legacy" hardware. Until everyone stops using shitty compuers, you'll have to support it.

Ok some of the hard problems should be super hard

Taking this challenge now that stomach is full, going for at least 3 of the 5 gets.

well shit

Euler's in C++.

I know. That's why I like the direction of WebAssembly and things like that. The less build targets you as a developer have to hit, the easier it is to maintain.

Aren't modern API's designed to support both versions in one source code?

You still have to compile your code twice

>sataniaposting
Cancer, begone.

If you compile to x86, depending on the language, it is supported in 64-bit as well. Just depends. But like said, you still have to compile it twice.

>still supporting x86 when, even some of the major distros stopped supporting it
sasuga, /dpt/

I don't have to but i'm pretty sure you have to have a developer by to create apple apps, right? And i wouldn't be able to test it on my own phone

I remember jokes being made about how dilapidated VB was in the fucking 90's, the fact that anyone could still be using it 10 years after the plug was pulled makes me believe those same users enjoy fucking corpses

If you turn on USB debugging on your phone (developer mode setting), and allow to install apps from untrusted sources, you can certainly test it on your own phone.
But you do need to have a developer license to publish to the Play Store.

That project makes me want to convert to Islam, nuke the entire planet, and rape every person that I find in Heaven. VB.NET WinForms + DataSets + SQL Server, its like a glitch in the fucking Matrix.

(÷∘2÷+⊢)⍣=

Sure, I will leave but only if you can make something better than what I make.

>currency converter
>venford's law
>graphic analog clock
>draw a spinning 3d cube
>tcp chat program with basic encryption
>create a hsv color representation

I'll be making at least 3 of these.

>tcp chat program with basic encryption
>not making a WebRTC DataChannel voice + video + chat app with RSA-4096 encryption
You really do belong in

That was what the challenge said, literally.
>implying I'm not making the encryption algorithm as well.

Now that I think about it, what does the "create" in
>create a hsv color representation
even mean? And wouldn't CIELAB or CIELUV (or to keep the hue component, CIELCh) be more interesting anyway?

WS1S will save systems programming.

post screenshots of your code

>if you can make something better than what I make.
>better than what i make
Anything is better than nothing.

i use vsc too, it's pretty comfy

...

Nothing interesting yet.

...

anyone here ever used java swing? How does a nigga go from one form to another?

>Perl
>le currant jahr
shiggy

I imagine they meant something like this.

Can a kind soul explain to me what are "generics" and it is a problem that Golang doesn't have them?
[/NotAProgrammer]

I had to write a script to deploy the database project for this project, since I can't use VS2017 in Debian. Ignore the spaghetti code.

>() => console.log(...)

instead of a simple

>console.log(...)

why

It's a chain of promises that resolves sequentially.

I could've easily just put them inside the next block, but this was at about four thirty last night, so I wasn't at my best. I'm just happy it deploys!

What would be the problem if you didn't use async keyword?

I'm someone else, but he couldn't have used await, I think?

The mssql package isn't synchronous, so I'd have to either do async/await or a bunch of callbacks.

>java

Is exercise 8.7 expecting me to use the sieve method I made in 8.5?
Cos I'm trying to write a method that doesn't call other methods and I can't get it to work.

There are different kinds of numbers, like whole numbers and fractions.
Say you want some code that adds up all the numbers in a list.
With generics you can write a single add function that applies to a list of whole numbers, a list of fractions, a list of real numbers or whatever.
Without them you must either copypaste your code into multiple functions, or lose type safety (i.e. the knowledge of what kind of number is being added) in order to do this.

But what's nice is since I am doing things asynchronously, this is all I have to do to run things sequentially: pastebin.com/QxikmuGm

my man. How's it going? have you found any problems to be particularly interesting?

Ok thanks, I see it.

And is these a good reason why Golang doesn't add this?

and the one in 8.6 i assume. that's one line of code though

Not same person, but see golang.org/doc/faq#generics

Adjust your autism.
8.5,6,7 are clearly laid out in such a progression that they blatantly invite you to reuse the code written in the previous exercise.
This is called reading between the lines. Useful for interacting with actual human beings too.
/shitpost
Srsly tho, do it via the expected approach -
reusing the code. Only then, if you're in the mood, do your own shit as an alternative implementation alongside the expected one.

What is a OutSystems Expert?

>I just want to make it look good and have some clickable buttons.
matlab gui
>look good
lower your expectations on that point though

Cuz go is Google's tard-proof language, meant to be simple enough that it minimizes fuckups by its pajeets and SJW koders.

>OutSystems Expert
success.outsystems.com/Evaluation/Getting_Started_With_OutSystems/05_Does_OutSystems_help_customers_build_applications/40_Expert_Services

fuck off, shill

?

Thanks

What are you talking about? I did a Google search, I didn't even read the link.

Made some contributions to a python script that extracts 2fa codes from your android, still waiting for google to receive my PR.

post link

Thanks. I've been away from general learning for some time now.

github.com/puddly/android-otp-extractor
My "real" PR hasn't been accepted but hopefully will be soon, I guess he just merged the second one and that broke the first.

#include
using std::vector;
vector sieve(int n){
if(n

res[0] = res[1] = 0;

...

for(int j = i*i; ...)

Huh?

>I'm trying to write a method that doesn't call other methods
Why?

I thought that's what they wanted. Anyway I've done it using the sieve method from the previous question.

Set the multiples of the prime to false. Obviously you don't start at the prime.

>153 screenshots

you're writing a rust compiler in python?

is that right?

i want to learn programming. What`s the best?i heard java

>i heard java

weak bait is weak

java is where you start if you want to be a code monkey

Python is the best for getting started and actually getting things done with it.

>Java
>code monkey
>$90K jobs

?

not bait. I really am just starting i just don`t know which computer language is the best one to find jobs for. Lots of places say java and second is php

Compiler for a c like lang. Compiler is written in python and I'm writing a backend that targets a VM that's written in rust.

>targets a VM that's written in rust.

so you write in a C like language that generates rust assembly code?

>I thought that's what they wanted.
But... why?

I'm doing it. No idea if it's going to land me anything though. I do have a maths degree (from 7 years ago, it's a lower second and I've been working in a supermarket for 4 years and I'm old.)

I kind of struggling to maintain momentum though, porn and vidya are literally beside me.

>every code gets translated into assembler which then into machine code
go kys now!

>compiler in python
enjoy your compile times

Literally why?
Are you a masochist for tedium?

It's a requirement from my Rust bootcamp

I wanted to reinstall mingw and msys since my version is too old amd deprecated but I forgot that sourceforge became bloatware now. The installer of this mingw release wants a registration code:
>After clicking Next, please do the following:
>1.- Enter a genuine organisation name in the second field
>2.- Take a screenshot
>3.- Email the screenshot to the email address below
>These details are required in order to notify you of updates and new versions as they become available. You can also request new features and/or technical support

I'm trying to bypass this crap with immunity debugger but I can't find anything, I tried using a randomly generated string as registration code to find it easily but no results show up.
Can anyone give me some directions, for example some guide with a similar example if possible. I wanted to learn assembly some time ago but never found the motivation to get serious, this looks like a good chance.

The reason why I want to install this program even though I could use any other mingw release out there is that I hate having to register to install free software, I'm on very low speed internet and it kinda pissed me off because the installer is over 150MB, this is the main reason, the other reason is that I want to learn how to fiddle with interfaces like this so I can do the same for other software.

>It's a requirement from my Rust bootcamp
[x] doubt

I'm overthinking things, I thought it was too obvious.

I dont plan on adding many features, currently most of the time is spent parsing and the IR generation is lightweight, but that might change if I get around to adding generics.

Utils
val primes: Stream[Int] = 2 #:: Stream.from(3) .filter {n => primes .takeWhile{_

i*2 has already been covered when 2 was scanned. Same with i*3, i*4=2i*2, i*5, ...., i*(i-1).

Just learn C++.

>def sieve(n: Int) = (0 until n) map isPrime

Brainlet.

github.com/qdot/deldo

Mobile apps are the future.
That means you should learn Java and Swift.

I'm surpised I don't see more adverts for Swift developers.

I'm half way through the java book, wouldn't it be better to finish it? I know a couple of people who claim they can get me something as long as I get some certs.

It's useless when you have a prime stream that's calculated basically in the same manner. But hey, might as well satisfy the problem statement for completeness' sake.
Not focused on utmost efficiency, obviously, but the approach ain't too bad at toy example scales.
We're optimizing for semi-smug one-liners after all.

>Swift
>need to have apple hardware
>100 dollars a year

I've read the book but haven't finished the exercises of the first chapter yet.

>tfw unironic triangle appears

Are you making a game?
see you in 10 years

True. But the people need their iPhone apps.

Grats.

couldn't care less that people need apps

boogie

󠇦 󠇦 ▲
▲▲

Why does no one submit pull requests for depression?

>see you in 10 years
>implying
It goes much faster once you make the fucking triangle appear. Been through this a couple of times already.

but i want a AAA game so get to work.

>but i want a AAA game
Getting there. (pic related)

How do i make myself look competent at the interneship/job fair, when the only coding ive done is for coursework.
I'm a senior.
Should I just kill myself now?

>not writing your own vulkan wrapper

Lol before you kill yourself please consider that there are self-taught people here who can't go to university at all.

Remember, make eye contact, give a firm handshake.

gamma-corrected?

Corollary: avoid female company representatives

On the contrary, don't throw away your (obvious) stud suaveness, but go directly for the broads that can be more easily manipulated.
Honeytrapping works both ways, after all.

So user, what makes you unique? What are some of your interests?

Because the source code is not freely available.

Just don't be yourself.

Programming socks. Dragon dildos.

>How do i make myself look competent
Ask dressing recommendations to Can't go wrong.

Guessing this is you, but just in case, see the replies on

/fa/ would probably tell him to dress like some hipster dork

Tried this earlier but everyone was busy screeching at each other

I'm doing some JS for WebGL and am kind of lost as to how to structure larger projects like simple 3d engines. I come from C++ and C#, so I have no idea what to separate on other files, whether it is preferred to stick to OOP or a more functional approach, etc

Just don't want to end up with a huge bowl of spaghetti a couple months from now

>full rick

hello friends! i convinced my gf to learn python and code with me for funsies (its something shes always wanted to do, she says) do you guys have any cool ideas for projects? or should we just go through the challenges or something

Why does my C pointers get fucked up...
I start with
ptr: 0xddf688
then i add (size_t) 4
and it becomes.
ptr: 0xddf77000000000

Programming challenge: Draw a strange attractor

Purdy

Oblig
>I've got a python for yo girl right here!

I understand monads, now what

...

I was thinking about getting into Swift, kinda hard when I don't own any apple products though. So many people have an iPhone, most people I know use them just for the camera, but I can see how getting involved in app development on their platform would be beneficial, looked up the license and it is 100 dollars a year. Do you have experience with it? Do you really think it's worth it? Should I stick to java?

Now you act superior and look down on everyone else.

rolling

>Do you have experience with it?
Honestly, not more than one school lab and I hated it.
But I really do think app development is the future, and no-one's going to take an app seriously if it's not on at least the two big platforms.

>void reverse(char * s){
>char line[MAXLINE]

Ew. Either use dynamic memory or do it in place or use c++.

#include
#include // for strlen
#include
#include
using std::string;

//option too poor for C++17
void ReverseString(char * str){
int n = strlen(str); // = std::char_traits::length(str);
for(int i = 0, j=n; i

>needing 8 different ways to reverse a string

C++ general

Trying to learn about hillclimbers & want to ask about the Knapsack problem. Basically I'm confused about how you would solve this by using a population of hillclimbers to try solve it in parallel when you have a Knapsack of about a capacity of 20 cubic inches & n=10 items of various sizes. The result is meant to be the Knapsack only the items that will provide the greatest total benefit within the knapsacks capacity. I'm trying to do this in Matlab.

How would use this by implementing it by doing it by:
1. An individual encoding the information solutions to the task
2. A genotype to phenotype mapping. How should the genotype be interpreted as
encoding a solution to our problem?
3. A fitness function. Basically a way to evaluate how good each phenotype is as a
potential solution to the card-sorting problem.
4. A method for mutation. Is it necessary to allow random changes in the offspring
produced by reproduction in order to maintain variability.

Also what's everyone's opinion on Julia? Is it worth learning?

If you can't find your own registration code, how about trying to find "Invalid Registration Code"?

Your debugger should have a "find all strings" or "find all references" button. If it doesn't, you might have to search every modules .rdata or memory manually. At some point the program will have to grab the "Invalid Registration Code" string. If you know the exact location in memory where that string is, you can set a hardware breakpoint to trigger when the program tries to access it. That access will almost definitely be when you've entered an invalid registration code.

If that works then great. You'll either find yourself in the middle of ntdll.dll or somewhere silly like that or in the middle of a function in the program. You can use the call stack or your own intuition to find out what functions and what branches were taken to lead you to that point. What you're looking for at this point is a function or branch that is only executed when you press the button that causes the registration code to be checked. Once you find that, you can start poking around in there and see if you can find the exact moment where your registration code is checked. You can sort of do that by littering it with breakpoints before and after function calls to see which get called and which do not, until you can work your way back to the exact moment the code gets checked.

lmao fuck

Once you find that, I would suggest determining if the check is entirely local or if it needs to connect to the internet to do it. (You can do that by running it in Sandboxie with internet access denied or turning your internet off and seeing if it complains about needing the internet) If it's connecting to the internet, you need to find out where it does and intervene yourself. Pull a Jedi mind trick and trick the program into thinking it connected to the server and the sever said everything was all OK. If it's local, you have the option of trying to reverse engineer the checking algorithm and creating your own registration code (ranges from easy to nightmare depending on how they've implemented it) or seeing if there's an easy point where it checks a single boolean value (output of the check function?) and flip it. It's also possible that it's both.

Putting your own registration code in is a good idea, but it's hard to track it down without a rough idea of when it might appear. If you get desperate you can see if your debugger has a trace function and set it to breakpoint when part of your registration code is loaded into one of the registers, but that would take a while to execute.

This would be what I would do in my first attempt. If that doesn't work there's also a few other ways you can try it - I can't pretend that I'm the most experience person myself. A lot of this might sound like nonsense, and I might not have explained it well, but if you persevere you will get there eventually.

>NEXPTIME-complete

>Also what's everyone's opinion on Julia? Is it worth learning?

It's in either the "too new, don't have your code broken by major changes" or "so old and yet has so little adoption, must be dead" camps.

roller

>too new, don't have your code broken by major changes
why does this even matter? That's part of the fun of pre 1.0 langs. You get to watch it change and hopefully evolve with time.

>how many layers of asymptotic complexity are you on right now?
>you are like a little O(1)
>watch this

def main():
graph = {
"a" : ["c"],
"b" : ["c", "e"],
"c" : ["a", "b", "d", "e"],
"d" : ["c"],
"e" : ["b", "c"],
"f" : []
}

print(generate_edges(graph))
print(list(graph.keys()))

def generate_edges(Graph):
edges = []

for node in Graph:
for neighbour in Graph[node]:
if (neighbour, node, 2) not in edges:
edges.append((node, neighbour, 2))
return edges

if __name__ == "__main__":
main()

Python noob and actual brainlet here.
How should I edit this block of code so my graph class can work with weighted links or edges? Thank you guys.

What the fuck is the point of doing any of this shit?
Literally why.
I mean no offense to any of you guys but this just makes me think as programmers as code monkeys. No mean to offend. Just tell me something to change my mind.

>she doesn't do code katas
>she doesn't have a diverse range of problem-solving skills
>she is the real code monkey

The challenges?
They're just meant as a jumping off for people who need a project or want to gauge where they are. Thinking through the implementation in your head is a lot different than actually writing it.

>What the fuck is the point of doing any of this shit?
Practice, and testing your skill.

Pic is what it's like to be an employed programmer.

- don't name your vars 'graph' and 'Graph'.
-- Graph looks like a class name
-- having them only differ by capitalization is a recipe for bugs
-- try e.g. 'graph' (as it's clear it's an adjacency list) and 'graphAdjList' - as given Python's duck typing, it's useful to hint at what format the function parameter is
>How should I edit this block of code so my graph class can work with weighted links or edges?
- one way to do it would be to switch your neighbor lists from lists of nodes to lists of (weight, node)
(code was supposed to be here, but admins are incompetent)
Then you just adjust the inner for loop to handle that.
Although I'd personally consider switching to a (set of nodes, set of edges) representation if you don't have outside requirements.

>she
keep dreaming

Fuck adjacency lists. Uses a matrix with weight values.

Proficiency in any trade is based on practice. But you can't throw your head against impossible tasks all the time so they have a bunch of simple ones on there.
I certainly don't find them all that useful but it's on the right path with some of the bigger projects. It can certainly be a useful experience to design a dungeons and dragons AI.

I'd rather see bigger 'handle generic user code' challenges though. Since most programmers will use libraries.
Might help thread quality too.

just dicking with homework. I just really like that line of code circled in red.

Thanks for replying. I'll see what I can do, like I said I'm pretty bad at this.

I share your appreciation of that code. It's both clear and concise.

Can we talk about reverse engineering?

No worries m8, you've got the right approach to this whole learning thing.
Just keep on doing it and ya'll get better with time and practice.

I like deconstructed tacos

I dislike having irrelevant side-effects in print statements. You'll get bitten by that habit soon enough.
(but it is cute)

What irrelevant side effect are you talking about here?

as long as it's programming related.

>scanf
>printf
disgusting.

>odd = size%2;
use odd= size&1;

>--foo isn't a side effect
really nigga?

Cmon he's obviously quite new.
I think the idea is that you don't want things to 'happen' in a program in print statements. It eases reading since you can now presume a print statement just outputs program state so it can be 'skipped' if you want to just understand what's going on.
Replacing '--tries' with 'tries' and decrementing before the print deals with that.

>average
>not median
to the trash it goes

what the shit is this

> Python: $100,717
Considering that, even if there is a particularly high demand for Python programmers (which I doubt), the fact that pretty much any normie/brainlet/hipster who wants to learn programming almost always starts with Python means that there is a steady, even overflowing supply of new Python programmers available to meet that demand, I have a real hard time believing that Python is more lucrative than professional software engineering languages like C/C++ or even something like Javascript.

Also, why is Objective-C on that list and not Swift?

Reminder that if you want your application to last the minimum you should do is to model your data.

You don't even have to use a database, you just need to know how each entity relates with other entities.

"Normalize your data" -- Jordan Peterson

tldr use a FPL
thanks petey

I use smalltalk and I think it's neat

I've had a bit to drink
// Fucked.cpp : Defines how fucked you are.
//

#include "stdafx.h"
#include
using namespace std;

bool isFucked = true;
int h = 0;

void fuck(bool isFucked) {
while (isFucked) {
if (h == 0) {
cout

What do you like about smalltalk, user? Show me something cool in it!

um...i like the live debugging. it's cool!

dumb question but
how do I do 1 in 16 chances using rand() in c?

Don't shadow globals with function parameters.
Avoid globals in cases like these.
An infinite loop is undefined behavior, this is very bad. Because if you don't have any input reliance you're at the good graces of your compiler. Probably won't matter in these cases but do keep it in mind.
Integer overflow is undefined behavior. What you wanted here is probably to extract the if statement with the AHHH
out of the while loop and just leave cout

!(rand() % 16)

Something like that, maybe?

rand() % 16
This gives you a random number between [0,15]
Its biased by 1/RAND_MAX towards 0 (both the random numbers 16 and 0 give you 0).
Which is probably fine for your use.
Now you can decide that you only do something when this gives you zero back with if(rand() % 16 == 0)

thanks guys

>over representation
Hmm actually it's worse than that I think.
Since you'll probably not map all of RAND_MAX evenly to your range.

Anyway this only really matters in lotteries and security.

Say i recovered an encryption key from a software, and i made a repository containing that key. How big of a trouble would i have if the software manufacturer found my repo?

Dunno what the company will do, but I know malicious actors will find that shit real quick

They could definitely fuck you if they felt like it.

>malicious actors
wat

Fancy term for hackers

AI that replaces Anime pictures with frogs

don't make me post rms's rant about that term

youtube.com/watch?v=FQRW0RM4V0k

stallman.org/articles/on-hacking.html

>I went to lunch with some GNU fans, and was sitting down to eat some tteokbokki (*), when a waitress set down six chopsticks right in front of me. It occurred to me that perhaps these were meant for three people, but it was more amusing to imagine that I was supposed to use all six. I did not know any way to do that, so I realized that if I could come up with a way, it would be a hack. I started thinking. After a few seconds I had an idea.

>First I used my left hand to put three chopsticks into my right hand. That was not so hard, though I had to figure out where to put them so that I could control them individually. Then I used my right hand to put the other three chopsticks into my left hand. That was hard, since I had to keep the three chopsticks already in my right hand from falling out. After a couple of tries I got it done.

>Then I had to figure out how to use the six chopsticks. That was harder. I did not manage well with the left hand, but I succeeded in manipulating all three in the right hand. After a couple of minutes of practice and adjustment, I managed to pick up a piece of food using three sticks converging on it from three different directions, and put it in my mouth.

Autism knows no bounds

>Lady Gaga's approach to clothing seems like hacking to me.
umm

How greedy is your algorithm, Cred Forums?

Done, finally. The attractor is the Lorentz attractors, with parameters P, R, B. Initial point is stored in X. The 3D points are then projected isometrically with a common matrix. Output is a PGM. Shrinks to fit largest dimension to D pixels. Outputs correct sRGB-encoded grayscale.
⎕IO ← 0

X ← .5 .5 .5
(P R B) ← 10 28 8r3
D ← 1000

M ← ⍬
:forlcl i :in ⍳1000
M ,← ⊂X
X +← .01 × (P × X[1] - X[0]) ((-X[1]) + X[0] × R - X[2]) ((X[0] × X[1]) - B × X[2])
:endforlcl

M ← (⊢-[0](⌊/)) ((⍉⊃M) +.×⍨ ÷ 2 3 ⍴ (√2) ∞ (-√2), √6 (3÷2) 6)
K ← 0 ⍴⍨ ((⌊.5∘+)⊢×(⌊/D∘÷)) ⌈/ M
K[⊂[0] ⌊ .5 + (D - 1) × ÷∘(⌈/,)⍨ M] +← 1

⍞ ← 'P2 ', (⌽⍴K), ' 255 '
⍞ ← ,⌊ .5 + 255 × (×∘(12.92∘×)∨(∼⊣)×⊢∘(-∘.055×∘1.055)∘(2.4∘√))⍨∘(≤∘0.0031308)⍨ K ÷ ⌈/,K

Oh, and I forgot. This is the output for 10000 points.

open source space engine W H E N?

Normally, I would count string size and malloc some temporary space (your first example would've been a much better solution; furthermore, I now realise I would've forgotten to free the allocated memory afterwards), but this is an exercise in the first chapter of K&R and dynamic memory isn't expected for this part.
But yeah, your first solution would've been ideal.

Now do an adaptive stepsize method.

Now you realize that computational processes aren't modeled well by categorical notions and go back to programming like a sane human being.

>cs major
>tfw 5 years into a 4-year degree

anyone know this feel

>Its biased by 1/RAND_MAX towards 0 (both the random numbers 16 and 0 give you 0).

Fucking CS majors... It's biases the the numbers less than (RAND_MAX+1)%modulus by
the ratio [(RAND_MAX+1)/modulus + 1] : [(RAND_MAX+1)/modulus] by looping around incompletely.

If (RAND_MAX+1)%modulus == 0 then there is no bias. On most systems RAND_MAX will be 2^15-1, 2^31-1, or 2^63-1 so you're fine if you use a power of 2 less than 2^15.

Learning temporal logic and model checking.

Trying to make backpropagation work in an example.