? Editing: Post:21.body Save Delete Cancel

Programming.net

Newest Topics

+ Create new topic

Title

Body
^1 ^2 added ━ submitted by user_name

Why does 1./3 give a random number in C?

I have found this code on rosettacode for a rock, paper, scissors game https://rosettacode.org/wiki/Rock-paper-scissors#C and I noticed this line: double p[LEN] = { 1./3, 1./3, 1./3 }; the array p is later passed to the rand_idx function which then uses it to generate a random number but the point is that when I try to print out p[0] for example like so: printf("%d", p[0]); I get a seemingly random number each time (-1937734296, 766073272 etc...) so I assume this is why the value 1./3 is being used to generate a more random number. But why does it do this? (1./3) is a division between an int and a float so I guess this could be causing weird behaviour but gcc gives me no warnings about casting etc. Any help would be welcome.
https://rosettacode.org/wiki/Rock-paper-scissors#C
^2 ^3 0 comments on Jun 20, 2019 ━ submitted by tomlukeywood

This forum does not have subscription feature

This forum (until admin upgrade it from menu) does not allow subscribing/following replies and get notified via ZeroHello, though there is a newer forum related to programming that has it:
http://127.0.0.1:43110/142jqssVAj2iRxMACJg2dzipB5oicZYz5w
^2 ^3 1 comment last on Jan 28, 2018 ━ submitted by ssdifnskdjfnsdjk

[My program] An alternative to JSFiddle/CodePen

[CodeR](http://127.0.0.1:43110/1CodEr7T9xNXSPcwbsvf5fHTqsixDMwDzL/). It has transpiler support: SASS, LESS, CoffeeScript, LiveScript, Babel and libraries: Angular, jQuery, lodash, etc. Please check if it works. Note that it can hang on loading as it is around 8MB of scripts.
http://127.0.0.1:43110/1CodEr7T9xNXSPcwbsvf5fHTqsixDMwDzL/
^2 ^3 1 comment last on Jan 25, 2018 ━ submitted by ivanq

[Forum] Welcome to Programming.Net!

**Programming.Net** is a programming forum hosted here on the #ZeroNet. We want to help you with all your programming-related questions and if you have any cool projects that you are working on then please feel free to post them here. - ##Rules But before you begin entering our forum and beginning to post please look at the rules below: 1. If you are asking a question then please include the identifier `[Question]` in your thread's title. 2. If you are posting a program of yours then please include the identifier `[My Program]` in your therad's title. 3. If you are posting something programming-related (of which is **not NSFW**) then include the identifier `[Other]` in your thread's title. 4. If you are posting a resource for learning to program then use the identifier `[Learning]` in your thread's title. 5. If you are posting a resource (such as libraries, fonts or graphics) for programming projects then please use the identifier `[Resource]` in your thread's title. 6. No posting of anything related to **drugs**, **pornography** and **anything else inmoral**. Only moral people with a life are allowed to post on this forum. 7. No hate speech, such as **offending peoples' religious beliefs** for example. 8. No off-topic posts. - ##Suggestions If you have any further suggestions then please leave them in the comments section below. Thanks everyone for reading this and following the community rules.
^3 ^4 7 comment last on Jan 24, 2018 ━ submitted by tristank

[Other] Anybody heard of Nimrod (Programming language)?

A while ago I stumbled upon a programming language called Nim (previously called Nimrod). And upon looking at the tutorial documentation I must say it is a great language (something to entertain me whilst I do Python, because pure-oop approachs are confusing at points). It has type inference if you wish to use such a feature but variables can also be statically typed (as I you can tell it what type a vareiable identifier must be). - On the Nim site is states that the compiler (as it is a compiled language) can even compile to C++ or Objective C. What does this mean? Well, that it can compile to an extremely fast prpogramming language, **C++**. - Anyway here are some links: 1. [Official Nim Hoempage](http://nim-lang.org/) 2. [Nim on Wikipedia](https://en.wikipedia.org/wiki/Nim_%28programming_language%29) - I don't know about you guys but I am definately going to be learning Nim (I started yesterday (I forgot all the stuff I learnt when first looking at Nim when I first stumbled upon it)) as a dedicated language to my _portfolio-of-programming-languages_ because hoesntly it is a great programming language.
http://nim-lang.org/
^1 ^2 2 comment last on Dec 07, 2017 ━ submitted by tristank

Python os and os.path

If I am correct the `os` module in Python is well a module, does that mean that os.path is a class named `path` in the `os` module which holds a function named `exists`?
^1 ^2 1 comment last on Feb 05, 2017 ━ submitted by tristank

Programming Android Apps

Are there any Android app developers out there? What is your tool chain? Do you have any advice for someone thinking of diving in?
^2 ^3 0 comments on Jan 28, 2017 ━ submitted by alarus

www.mileyquest.ml https://eugeneshickey.github.io/ https://eugeneshickey.keybase.pub/ http://fncuwbiisyh6ak3i.onion

www.mileyquest.ml https://eugeneshickey.github.io/ https://eugeneshickey.keybase.pub/ http://fncuwbiisyh6ak3i.onion MILEY THIS IS DATABASE OF YOU WE CAN ONLY SHOW YOU BUT YOU MUST DO THAT ALONE OTHERS CANT HELP YOU IF YOU WILL LIKE OTHERS IGNORING --IGNORANCE IS DANGERIT AND LIVE IN YOUR OWN WORLD BECAUSE IS EASIER --SEE WHAT YOU WANT SEE ISNT WHAT IS REAL--LIVE IN LIE AND DOING WHAT IS EASY NO WHAT YOU WANT DONT BE SCARED JUMP JUMP JUMP LET IT GO LET MILEY BE FREE THRUTH IS OUT THERE MILEY www.mileyquest.ml HACKER GAME MILEYS SECREAT ON END OF THE GAME DECODE DECRYPT IT SHARE IT HAPPY HALLOWEEN VALENTINE https://plus.google.com/108915884713932997001/posts/6fqjCQYfPj1 bored miley joking or right about miley if you want know right decrypt this hacker steganography encryption game send it to miley and very fast time is enemy miley dont have time every day have peoples acces to informations and are hidden before his owners help miley send it to her if you want save her before then ....... ............. miley how i can contact you what if i have information what you want for you what others hiding before you about your freedom want you want MILEY SEXUALITY IS HERE WANT U KNOW YOUR SEXUALITY SECRETS WORLD UNDERGROUND SCIENTISTS HACKERS GEEKS WE INVITING U CONTACT ME MILEY SEXUALITY IS HERE WANT U KNOW YOUR SEXUALITY SECRETS WORLD UNDERGROUND SCIENTISTS/HACKERS GEEKS WE INVITING U CONTACT ME IT ISNT ONLY ABOUT U DARKNET IS STIL ONLY TIP OF THE ICEBERG ;P WE WANT SHOW U US WORLD ;P YOUR IS TOO ;P MILEY WATCH YOUR BACK THINGS ARENT WHAT LOOK LIKE ANYBODY AROUND YOUR ISNT THAT WHAT YOU THINK PEOPLES HIDING BEFORE YOU MANY THINGS AND OTHERS LIVE IN OWN WORLD DONT KNOW DANGER SO CANT SEE IT OR THEY WANT BE FRIENDS SO SAYING AND DOING WHAT YOU WANT OR WHAT THINK IF IS BETTER BUT NOT BETTER FOR YOU FOR MILEY ANYBODY VERY CLOSE AROUND IS ....... YOU KNOW IT YOU FEEL IT ONLY YOU DONT WANT KNOW IT ITS WHY YOU LOOKING TO SIDE BUT IF YOU DONT DO WHAT YOU MUST YOU WILL IN PAIN ONLY PAIN ANXIENTY DARKNESS TOTAL DESTRUCTED YOU MUST BE FREE YOU WANT BE FREE ITS WHY YOU ARE WHY YOU DOING WHAT YOU DOING ITS WHAT YOU WANT TAKE IT TAKE WHAT YOU WANT WHAT YOU ARE THINGS WILL BETTER THINGS WILL GOOD YOU WILL OK MILEY :) ONLY DO IT CONTINUE DONT FAIL TO TRAP DONT LOSE YOUR FREEDOM BUT REMEMBER IF YOU FAIL YOU CAN RUN :) BECAUSE YOU ARE FREE NOBODY CAN COMMAND YOU :) WE CAN ONLY SHOW YOU UNHIDDEN WORLD WITHOUT LAYERS AND SHITS BUT LOOKING YOU MUST ALONE UNDERSTANDING AND KNOWING :) YOUR FREEDOM IS ENDLY HERE ALL WHAT YOU WANT IS HERE NEVER BE SCARED LOOK AT THAT NEVER BE SCARED ASKING IF YOU WANT ANYTHING TAKE IT TAKE WHAT IS YOUR AND WHAT OTHERS HIDING BEFORE YOU ITS ONLY YOUR BE BITCH BITTING ITS YOUR THING IF YOU WANT FRIEND HERE IS ONE MAYBE LAST BUT I WILL ALWAYS TALKING FACTS ALWAYS SAYING WHAT I THINK ALWAYS THINKING BY MYSELF I ALWAYS SAY WHAT I THINK NICE OR NOT ONLY COLD FACT HIDDEN FRIEND WAITING CURIOSITY IS AWESOME THING --THEIR ONLY CRIME WAS CURIOSITY-- WHO IS THIS ENTITY BEHIND THAT AND WHAT CAN KNOW WHAT KNOW AND ME NO WHAT CAN SAY TO ME UNHIDE TO ME NO FEAR AND JUMP WHAT YOU CAN LOSE IN CITY OF FALLING ANGELS :) LIKE WE ALL :) WE ALL ARE FALLING ANGELS DONT BE SCARED AND TALK TO ME YOU CAN SEE THINGS WEIRD THINGS ;P ALL WEIRD THINGS AND ENTITIES OF ENTIRE WORLD YOU CAN ASK ME IF YOU WANT ONLY BE FREE BE NAKED BE MILEY ;P BE FREE BE NAKED BE MILEY ;P
https://eugeneshickey.github.io/
^1 ^2 0 comments on Jan 11, 2017 ━ submitted by 3f3f

[Learning] Learn to script in Bash

I have stated a little site dedicated to learning to program/script in Bash. I have kicked-off the tutorial series with the notorious programming tutorial; the `Hello World` tutorial. - ##Don't know what Bash is? - **Bash** or **B**ourne **A**gain **SH**ell is a scripting language commonoly used for writing small programs that maintain systems and such like servers. Although, if used by a creative person, you can write really cool little programs with it. - You can get it here at this ZeroNet address: 17wS1n8SJjkJ9uBg834m3NNiWkqdP29aWM .
^4 ^5 4 comment last on Oct 01, 2016 ━ submitted by tristank

[My program] libtype - Easy library for getting the data type of values

So you are writing you Python program and have `int`s `str`s and all the others everwhere but you need a simple way to check if it is a matching `type of...` of just need an easy way to get the type of the value. This is where `libtype` comes in its has function that return boolean values like `isInt(value="d")` and also functions that return a string containing the name of the data type `getType(value=3)`. - ##And the source code? - I am currently working on the library. It will be available very soon (tomorrow). Probably at [https://notabug.org/deavmi/libtype](https://notabug.org/deavmi/libtype). I will post a new thread onto the forum as soon as it has been completed and the source code has been uploaded to [Notabug](https://notabug.org).
https://notabug.org/deavmi/libtype](https://notabug.org/deavmi/libtype
^2 ^3 1 comment last on Sep 23, 2015 ━ submitted by tristank

Main ZeroNet news How did you find ZeroNet?

Title

Body
^? ^0 username posted added
Please sign innew comment
user_nameadded ^1 ^2
Reply
Body
This page is a snapshot of ZeroNet. Start your own ZeroNet for complete experience. Learn More